The quadrature of general, highly oscillatory integrals is a relatively complicated computational problem that occurs in a wide range of practical applications, e.g. in physics, chemistry, and image analysis. It is often necessary to use a high number of nodal points with classical quadrature formulas in order to achieve a required accuracy of numerical integration of rapidly oscillating functions. However, an increase in integration points leads to a larger computational time. Our work describes and analyses a method for numerical integration of rapidly oscillating functions, which enables to obtain the required accuracy with a smaller number of nodal points than classical integration rules and with a relatively simple integration formula. The proposed method is generally suitable for integration of rapidly oscillating functions in various applications. The method is demonstrated in examples of calculation of the diffraction integral in optics, where the integrand is often a rapidly oscillatory function. The results can be readily adapted to similar problems from other fields. Copyright (C) 2009 John Wiley & Sons, Ltd.