The masses of ^{246}Es, ^{251}Fm, and the transfermium nuclei ^{249-252}Md and ^{254}No, produced by hot- and cold-fusion reactions, in the vicinity of the deformed N=152 neutron shell closure, have been directly measured using a multireflection time-of-flight mass spectrograph. The masses of ^{246}Es and ^{249,250,252}Md were measured for the first time. Using the masses of ^{249,250}Md as anchor points for α decay chains, the masses of heavier nuclei, up to ^{261}Bh and ^{266}Mt, were determined. These new masses were compared with theoretical global mass models and demonstrated to be in good agreement with macroscopic-microscopic models in this region. The empirical shell gap parameter δ_{2n} derived from three isotopic masses was updated with the new masses and corroborates the existence of the deformed N=152 neutron shell closure for Md and Lr.