In general, if we consider a measurable function $f: (\Omega_0, \mathcal{F}_0) \to (\Omega_1, \mathcal{F}_1)$ between two measurable spaces, $f$ is called measurable iff
$$\forall B \in \mathcal{F}_1\quad f^{-1}(B) = \{\omega \in \Omega_0 \mid f(\omega) \in B\} \in \mathcal{F_0}$$
Now we have $g = f$ a.e. on $\mu$ -- a measure defined on $(\Omega_1, \mathcal{F}_1)$. If we denote $A = \{\omega \in \Omega_0 \mid g(\omega) \neq f(\omega)\}$ as the set that they disagree on, we know that (1) $A \in \mathcal{F}_0$ and (2) $\mu(A) = 0$.
To show that $g$ is also measurable, we follow the definition and take any $B \in \mathcal{F}_1$, and note that:
$$
\begin{align}
g^{-1}(B) &= \{\omega \in \Omega_0 \mid g(\omega) \in B\} \\
&= \{\omega \in \Omega_0 \mid g(\omega) \in B, \omega \in A \} \cup \{\omega \in \Omega_0 \mid g(\omega) \in B, \omega \in A^c\}
\end{align}
$$
and our goal is to show $g^{-1}(B) \in \mathcal{F}_0$. For the first part, notice that this is a subset of $A$, which is a null set in $\mu$ (i.e. $\mu(A) = 0$). This is where the completeness of measure space makes things easy -- any subset of a null set must be inside $\mathcal{F}_0$ by definition.
Next, for the second part, we easily have
$$
\{\omega \in \Omega_0 \mid g(\omega) \in B, \omega \in A^c\} = \{\omega \in \Omega_0 \mid f(\omega) \in B, \omega \in A^c\}
$$
since $f = g$ on $A^c$, and the latter set is simply $f^{-1}(B) \cap A^c$. Now since $f$ is measurable we have $f^{-1}(B) \in \mathcal{F}_0$, and $A^c \in \mathcal{F}_0$ trivially as well. We thus show that $g^{-1}(B) \in \mathcal{F}_0$.