We present an efficient method for calculating the reflectivity of three-dimensional gratings on multilayer films based on a finite-element, Green's function approach. Our method scales as NlogN, where N is the number of plane waves used in the expansion. Therefore, it is much more efficient than the commonly adopted rigorous-coupled-wave analysis (RCWA), which scales as N3. We demonstrate the effectiveness of this method by applying it to a two-dimensional periodic array of contact holes on a multilayer film. We find that our Green's function approach is about one order of magnitude faster than the RCWA approach when applied to typical contact holes considered in industry. For most cases, this method is efficient enough for application as a realtime, critical-dimension metrology tool.