This paper presents a structure-preserving spatial discretization method for distributed parameter port-Hamiltonian systems. The class of considered systems are hyperbolic systems of two conservation laws in arbitrary spatial dimension and geometries. For these systems, a partioned finite element method is derived, based on the integration by parts of one of the two conservation laws written in weak form. The nonlinear 1D Shallow Water Equation (SWE) is first considered as a motivation example. Then the method is investigated on the example of the nonlinear 2D SWE. Complete derivation of the reduced finite-dimensional port-Hamiltonian system is provided and numerical experiments are performed. Extensions to curvilinear (polar) coordinate systems, space-varying coefficients and higher-order port-Hamiltonian systems (Euler-Bernoulli beam equation) are provided.