In this paper we consider a model shape optimization problem. The state variable solvesan elliptic equation on a domain with one part of the boundary described as the graph of acontrol function. We prove higher regularity of the control and develop a priorierror analysis for the finite element discretization of the shape optimizationproblem under consideration. The derived a priori error estimates areillustrated on two numerical examples.