In nonrelativistic mechanics, given a lagrangian $L$, we define the action as $$S[q]=\int L(q(t),\dot q(t))dt$$ and we can prove (see, for example, this answer for the first equation) $$\begin{align} \frac {\partial L} {\partial \dot q^i} &= \frac {\partial S} {\partial q^i} \\ \dot q^i \frac {\partial L} {\partial \dot q^i} -L&= -\frac {\partial S} {\partial t} \end{align} $$ so we call the first quantity generalized momentum (covariant components) and the second quantity 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)$$
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)$$ 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)$$
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?