P granules are non-membrane-bound RNA-protein compartments that are involved in germline development in C. elegans. They are liquids that condense at one end of the embryo by localized phase separation, driven by gradients of polarity proteins such as the mRNA-binding protein MEX-5. To probe how polarity proteins regulate phase separation, we combined biochemistry and theoretical modeling. We reconstitute P granule-like droplets in vitro using a single protein PGL-3. By combining in vitro reconstitution with measurements of intracellular concentrations, we show that competition between PGL-3 and MEX-5 for mRNA can regulate the formation of PGL-3 droplets. Using theory, we show that, in a MEX-5 gradient, this mRNA competition mechanism can drive a gradient of P granule assembly with similar spatial and temporal characteristics to P granule assembly in vivo. We conclude that gradients of polarity proteins can position RNP granules during development by using RNA competition to regulate local phase separation.