We consider a variational formulation of the three-dimensional Navier–Stokes equations with mixed boundary conditions and prove that the variational problem admits a solution provided that the domain satisfies a suitable regularity assumption. Next, we propose a finite element discretization relying on the Galerkin method and establish a priori and a posteriori error estimates.