Yes you can, with $f(x,y)=xy$.
[Added] A little more detail: $f$ is continuous (which should be well-known) and $\{1\}$ is closed in $\mathbb{R}$, so you only need to show that $A = f^{-1}[\{1\}]$ to see $A$ is closed: if $(x,y) \in A$ then in particular $y = \frac{1}{x}$, so $xy = 1$ and so $(x,y)$ is in the inverse image, while if $(x,y)$ is in the inverse image, we know $f(x,y) = xy = 1$ which implies that $x$ (and $y$) are $\neq 0$, and so we can divide both sides by $x$ to see $y =\frac{1}{x}$, so $(x,y) \in A$.