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 Nitsche’s method. We prove optimal order a priori error estimates for piecewise continuous polynomials of order (Formula presented.) in the energy and (Formula presented.) norms that take the approximation of the surface and the boundary into account.