Function measurable iff the components are?
The case $n=2$ generalizes by induction so this is what we'll show. Let $U \subset \mathbb{R}^2$ be open. As $\mathbb{R}^2$ is separable and open balls in $\mathbb{R}^2$ are countable union of open intervals in $\mathbb{R}$ we may write $$U = \cup_{j=1}^\infty ( (a_{j1},b_{j1}) \times (a_{j2}, b_{j2}))$$ for some family of intervals. Here its understood that the endpoints could be $\infty$ or $-\infty$. Now, its quick to verify $$f^{-1}(U) = \cup_{j=1}^\infty (f_1^{-1}(a_{j1},b_{j1}) \cap f_2^{-1}(a_{j2},b_{j2}))$$ which is a Borel set as $f_1$ and $f_2$ are both Borel measurable.
Note this argument holds for any countable product of separable metric spaces.