In nonrelativistic mechanics, given a lagrangian $L$, we define the action as 
$$S[q]=\int L(q(t),\dot q(t))dt\tag{1}$$
and we can prove (see, for example, [this answer][1] for eq. (2))
$$\begin{align}
\frac {\partial L} {\partial \dot q^i} &= \frac {\partial S} {\partial q^i} \tag{2} \\
\dot q^i \frac {\partial L} {\partial \dot q^i} -L&= -\frac {\partial S} {\partial t}\tag{3}
\end{align}
$$
so we call quantity (2) *generalized momentum* (covariant components) and  quantity (3) *energy* of the particle.

In special relativity (signature $(+,-,-,-)$) the definition of 4-momentum I know from lesson is $$p_\mu = -\frac {\partial S} {\partial q^\mu}=\left (-\frac 1 c \frac {\partial S} {\partial t} , - \frac {\partial S} {\partial q^i}\right). \tag{4}$$

The spatial part of this 4-vector seems to be the opposite of the nonrelativistic generalized momentum, and this breaks the known equation $$p_\mu = \left (\frac E c, -p_i \right).\tag{5}$$
Both my professor and Landau-Lifhitz get rid of this extra minus sign, by saying that raising a spatial index changes sign, and covariant and contravariant components in nonrelativistic euclidean metric are equal, so we can write
$$p^\mu = \left (\frac E c, p^i \right). \tag{6}$$


However, this reasoning seems flawed to me, because, in my understanding, the classical equations work with any metric, so they would work even with the metric $g_{ij} = -\delta_{ij}$, which is the one we use when we see $\mathbb R ^3$ as subspace of $\mathbb R ^{1,3}$. In other words, it seems to me that they are just arbitrarily exchanging the covariant and contravariant components of the vector. How can we make this more rigorous?

 [1]: https://physics.stackexchange.com/a/383663/183311