Let F={E∈B(Y)∣f−1(E)∈B(X)}. Since f is continuous, f−1(U) is open for any open set U⊆X, hence Borel. Thus, F contains the open sets, so it suffices to show that F is a σ-algebra:
X is open, so X∈F.
Given E∈F, if x∈(f−1(E))c, then f(x)∈Ec, so x∈f−1(Ec). Conversely, if x∈f−1(Ec), then f(x)∈Ec. But if x∈f−1(E), then f(x)∈E, so by contrapositive, we see x∈(f−1(E))c. Thus, (f−1(E))c=f−1(Ec), and since B(X) is a σ-algebra, it follows that f−1(Ec)∈B(X)⟹Ec∈F.
Finally, given {En}n⊆F,
x∈f−1(n=1⋃∞En)⟺∃n:f(x)∈En⟺∃n:x∈f−1(En)⟺x∈n=1⋃∞f−1(En),
so f−1(⋃n=1∞En)=⋃n=1∞f−1(En). Since B(X) is a σ-algebra, it follows that f−1(⋃n=1∞En)∈B(X), so ⋃n=1∞En∈F.
This shows that F is a σ-algebra containing the open sets, so by definition of the Borel sets, B(Y)⊆F, which completes the proof.