The matching of 3-D anatomical surfaces to 2-D X-ray projections is an important problem in Computer and Robot Assisted Surgery. We present a new method for determining the rigid body transformation that describes this match. Our method performs a least squares minimization of the distance between the camera-contour projection lines and the surface. To correctly deal with projection lines that penetrate the surface, we minimize the square of the minimum signed distance along each line (distances inside the object are negative). To quickly and accurately compute distances to the surface, we represent the precomputed distance map using an octree spline whose resolution increases near the surface. The octree allows us to quickly find the minimum distance along each line using best-first search. We present experimental results of 3-D surface to 2-D projection matching, and also show how our method works for 3-D to 3-D surface matching.