We consider classical Euclidean gravity solutions with a boundary. The boundary contains a non-contractible circle. These solutions can be interpreted as computing the trace of a density matrix in the full quantum gravity theory, in the classical approximation. When the circle is contractible in the bulk, we argue that the entropy of this density matrix is given by the area of a minimal surface. This is a generalization of the usual black hole entropy formula to euclidean solutions without a Killing vector. A particular example of this set up appears in the computation of the entanglement entropy of a subregion of a field theory with a gravity dual. In this context, the minimal area prescription was proposed by Ryu and Takayanagi. Our arguments explain their conjecture.