Hartshorne's proof that $\mathcal{O}_{\operatorname{Spec} A}(D(f)) \cong A_f$, Prop II.2.2(b) Hartshorne, "Algebraic Geometry," Proposition II.2.2(b) on page 71 reads (roughly):

$\mathcal{O}_{\operatorname{Spec} A}(D(f)) \cong A_f$

The relevant section of the proof reads (after some simplification):

We define $\psi : A_f \to \mathcal{O}_{\operatorname{Spec} A}(D(f))$ by sending $a/f^n$ to the section which assigns to each $\mathfrak{p}$ the image of $a/f^n$ in $A_\mathfrak{p}$.   First we show that $\psi$ is injective.  If $\psi(a/f^n) = 0$, then for every $\mathfrak{p} \in D(f)$ we have $a/f^n = 0$ in $A_\mathfrak{p}$, so by definition there is some $h \not \in \mathfrak{p}$ such that $h a = 0$ in $A$.  Let $\mathfrak{a}$ be the annihilator of $a$ in $A$.  Then $h \in \mathfrak{a}$ and $h \not \in \mathfrak{p}$, so $\mathfrak{a} \not \subseteq \mathfrak{p}$.  We conclude that $V(\mathfrak{a}) \cap D(f) = \emptyset$.  Therefore $f \in \sqrt{\mathfrak{a}}$, so $f^\ell \in \mathfrak{a}$ for some $\ell$, so $f^\ell a = 0$.  Since $f$ is a unit in $A_f$, this says that $a = 0$ in $A_f$.  The hard part is to show that $\psi$ is surjective...

I follow the argument fine, but it strikes me as particularly ingenious, despite Hartshorne's implicit assertion that it's the "easy part" of the argument.  (To be fair, the proof of surjectivity takes a whole page.)  In particular, the fact that we're checking a commutative algebra result to apply to a problem in algebraic geometry by applying algebraic geometry to the commutative algebra problem kind of blows my mind at the moment.
Is this really just a very clever argument, or is there some perspective from which it's straightforward?  Alternatively, is there some other way of seeing this result?
 A: If $S\subset A$ is a multiplicative system, and $x\in S^{-1}A$ is such that $x=0$ in every $A_P$ with $P\cap S=\emptyset$, then $x=0$ since it is $0$ in all localizations of  $S^{-1}A$.
A: It's remarkable that this all works out so cleanly, but somehow this argument should be obvious if you believe that elements of commutative rings behave like functions on a space.
$D(f)$ is the collection of points where $f$ doesn't vanish.  So it stands to reason that if a function $a$ vanishes at all those points, then its product with $f$ should be zero.  And since $f$ is invertible on $D(f)$, $a$ is annihilated by a unit, and so must be algebraically zero there.
That argument doesn't quite work here, because "vanishing everywhere" means lying in every prime ideal, and lying in every prime ideal means being in the nilradical, not equalling zero per se.  But it gets us most of the way to the actual argument, so I don't think it would be unreasonable to call the argument straightforward.
All that said, from a purely mechanical standpoint, I've always found arguments that use annihilators like this to be rather striking and clever.  Very often, it seems like my ability to derive technical lemmas is directly proportional to my ability to remember to consider the collection of primes that contain the annihilator of something.
