If $f$ an isomorphism of ringed spaces, is $f$ necessarily an isomorphism of locally ringed spaces?

I'm not sure that this is generally true, but Harthorne p73 seems to suggest it. If it is true could someone give me a hint for the proof?

-
Of course this is true, provided that the stalks are local rings. Because the isomorphism induces isomorphisms of stalks. And an isomorphism of local rings must carry the maximal ideal into the maximal ideal. –  Andrew Oct 15 '12 at 15:45
But the induced isomorphism isn't to the same stalk as in the definition of locally ringed space. In particular you get an induced isomorphism to $f_{*}(\mathcal{O}_X)_{f(P)}$ but we need that the homomorphism to $(\mathcal{O}_X)_P$ obtained by composing this isomorphism with the restriction map is a local homomorphism. I don't quite see how to do this! –  Edward Hughes Oct 15 '12 at 16:09
In the paragraph you're referring to, Hartshorne is assuming that $f$ is a morphism of locally ringed spaces. –  Fredrik Meyer Oct 16 '12 at 12:33
@EdwardHughes:I am sorry but I don't quite see what you mean. See if you agree with this: $f_{*,x}:\mathcal O_{Y,f(P)} \to f_*(\mathcal O_X)_{f(P)}$ is an isomorphism. –  Andrew Oct 16 '12 at 14:36