The quasilocal energy of gravitational and matter fields in a spatially bounded region is obtained by employing a Hamilton-Jacobi analysis of the action functional. First, a surface stress-energy-momentum tensor is defined by the functional derivative of the action with respect to the three-metric on \({}^3B\), the history of the system's boundary. Energy density, momentum density, and spatial stress are defined by projecting the surface stress tensor normally and tangentially to a family of spacelike two-surfaces that foliate \({}^3B\). The integral of the energy density over such a two-surface \(B\) is the quasilocal energy associated with a spacelike three-surface \(\Sigma\) whose intersection with \({}^3B\) is the boundary \(B\). The resulting expression for quasilocal energy is given in terms of the total mean curvature of the spatial boundary \(B\) as a surface embedded in \(\Sigma\). The quasilocal energy is also the value of the Hamiltonian that generates unit magnitude proper time translations on \({}^3B\) in the direction orthogonal to \(B\). Conserved charges such as angular momentum are defined using the surface stress tensor and Killing vector fields on \({}^3B\). For spacetimes that are asymptotically flat in spacelike directions, the quasilocal energy and angular momentum defined here agree with the results of Arnowitt-Deser-Misner in the limit that the boundary tends to spatial infinity. For spherically symmetric spacetimes, it is shown that the quasilocal energy has the correct Newtonian limit, and includes a negative contribution due to gravitational binding.