Is Hamilton's principle compatible with the relativity principle? The principle of Hamilton in classical mechanics is a fundamental one. It states that the real trajectory of a particle extremize the action 
$$ \int_{t_1}^{t_2} d \tau  L (q , \dot{q}, \tau )  . $$
In this formalism, time has a different status than space. 
The problem is then, is it compatible with relativity? 
 A: *

*Yes, the stationary action principle, 
$$\delta S~=~0,\tag{1}$$
also known as the Hamilton's principle$^1$ (where 
$$S~=~\int \! \mathrm{d}t~ L, \qquad L~=~\int \! \mathrm{d}^3x~{\cal L},  \tag{2}$$ 
is the Lagrangian action functional) can be manifestly Lorentz covariant and/or manifestly generally covariant, if the underlying theory respects these symmetries. 

*Concerning relativistic point particles, there exist stationary action principles with manifestly reparametrization invariant world-line parameter, cf. e.g. this, this, this, this, & this Phys.SE posts and links therein.
__
$^1$ Despite the name, the Hamilton's principle is part of the Lagrangian (rather than the Hamiltonian) formulation. Concerning the relativistic status of Hamitonian formulations, see also this related Phys.SE post and links therein.
A: There are ways to cram relativity into this formalism, but they're awkward, convoluted, and rarely used.
The much more common approach is to replace the Lagrangian with a Lagrangian density - a functional on fields $\mathcal{L}(\partial_\mu \varphi, \varphi, x, t)$, where $\partial_\mu \varphi$ denotes a partial derivative of the field $\varphi(x, t)$ with respect to the variable $\mu$, which ranges over $x, y, z,$ and $t$.  The Lagrangian density is a Lorentz-scalar field and therefore Lorentz-invariant.  In principle, the Lagrangian $L(t)$ itself is a spatial integral of the Lagrangian density ($L(t) = \int d^3x\ \mathcal{L}(x, t)$), and the action $S$ is the time integral of the Lagrangian as usual ($S = \int dt\, L(t)$).  But the Lagrangian $L$ is frame-dependent, so in practice it's much nicer conceptually to go right from the Lagrangian density to the action by integrating over spacetime ($S = \int d^3x\ dt\ \mathcal{L}(x, t)$) - it turns out that this integral is Lorentz-invariant.  So everything is expressed in terms of local, Lorentz-covariant fields, and space and time derivatives and integrals are treated on equal footing.
For example, a common Lagrangian density for a relativistic scalar field $\varphi(x, t)$ is
$$ \mathcal{L}(\partial_\mu \varphi, \varphi) = \frac{1}{2} \sum_{\mu = x, y, z, t} \partial_\mu \varphi \partial^\mu \varphi - \frac{1}{2} m^2 \varphi^2.$$
In relativistic quantum field theory, the excitations of this scalar field correspond to particles with a mass given by the parameter $m$.
A: For field theory, you must instead use the Lagrangian density 
$$S=\int_\Omega d^4x \mathcal L (\phi,\partial \phi)\;.$$
(You may add also $\partial \partial \phi$)
In curved spacetime it generalized to
$$S[\phi]=\int_\Omega d^4x \sqrt{-g} \mathcal L (\phi,\partial \phi)\equiv \int_\Omega d^4x \tilde {\mathcal L} (\phi,\partial \phi)\;,$$
where tilde indicate that it is a scalar density. The Euler-Lagrange eqn reads
$$ \frac{\partial \mathcal L}{\partial \phi} - \nabla_\mu(\frac{\partial \mathcal L}{\partial {\nabla_\mu\phi}}) =0\;.$$
For the gravitational field $g_{\mu\nu}(x)$ the action is
$$S[g_{\mu\nu}]=\int_\Omega d^4x \sqrt{-g} \mathcal L (g,\partial g)=\frac{c^3}{8 \pi G}\int_\Omega d^4x \sqrt{-g} R$$
