  We apply variational principles in the context of geometrothermodynamics. The
thermodynamic phase space ${\cal T}$ and the space of equilibrium states ${\cal
E}$ turn out to be described by Riemannian metrics which are invariant with
respect to Legendre transformations and satisfy the differential equations
following from the variation of a Nambu-Goto-like action. This implies that the
volume element of ${\cal E}$ is an extremal and that ${\cal E}$ and ${\cal T}$
are related by an embedding harmonic map.
  We explore the physical meaning of geodesic curves in ${\cal E}$ as
describing quasi-static processes that connect different equilibrium states. We
present a Legendre invariant metric which is flat (curved) in the case of an
ideal (van der Waals) gas and satisfies Nambu-Goto equations. The method is
used to derive some new solutions which could represent particular
thermodynamic systems.
