I started with assuming $a$ and $b$ are rationals. Then I expressed an arbitrary interval $(a,b)$ as $$\left\{\bigcup_n \;\left[a+ \frac{1}{n},\infty\right)\right\} \; \bigcap \; \left\{\bigcup_n \; \left[b+\frac{1}{n}, \infty\right)\right\}$$
It follows from the properties of the Borel sigma algebra and our given property that the above representation is a Borel set. But how can I extend this to a, b which are irrational?
I thought to use the the density of the rationals in the real numbers but I fail to see how I could apply this since $f^{-1}$ is not necessarily continuous so I can't just take the limit inside. Another tool which comes to mind is the fact that between any two real numbers there is a rational. But again I don't see how I can apply this.
If $a$ is any real number, there is an increasing sequence of rational numbers $r_n$ such that $r_n< a$ and $r_n\to a$ as $n\to \infty$. Also, $$\bigcap_{n}\{x|f(x)\geq r_n\}=\{x|f(x)\geq a\}$$
Hence the l.h.s is a countable intersection of Borel sets. Since $a$ was arbitrary, $f$ is Borel.