We here report our experimental study of the quantum size effect modulated metalation reaction of phthalocyanine (H(2)Pc) by low temperature scanning tunneling microscopy. When iron atoms were deposited onto Pb(111) thin films (2-5 nm thick) precovered by a self-assembled H(2)Pc monolayer, a surface metalation reaction to iron phthalocyanine (FePc) was observed. The amount of the FePc products was found to change prominently whenever the film thickness varies by one atomic layer and exhibits thickness-dependent oscillatory behavior. We show that the oscillation can be well-understood by the quantum size effect in the Pb thin films. The present study gives direct proof for tailoring a surface chemical reaction by quantum confinement.