We develop a finite element method for the Laplace-Beltrami operator on a surface with boundary and nonhomogeneous Dirichlet boundary conditions. The method is based on a triangulation of the surface and the boundary conditions are enforced weakly using Nitsches method. We prove optimal order a priori error estimates for piecewise continuous polynomials of order $k geq 1$ in the energy and $L^2$ norms that take the approximation of the surface and the boundary into account.