Lt. Gov. Ralph S. Northam won the hotly contested race for Virginia governor with huge margins in metropolitan Virginia, and especially the populous Washington suburbs. Mr. Northam, a Democrat, won by 9 points over Ed Gillespie, a Republican — a wider margin than Hillary Clinton’s 5-point victory over Donald J. Trump last year.

Vote Density Sparsely populated Densely populated Mostly Democratic About even Mostly Republican

Mr. Northam also fared well in southeastern Virginia, where the state’s large black population helps power Democratic margins that combine to rival northern Virginia. Mr. Northam, who hails from the state’s eastern shore, posted some of his best tallies in the region. He carried Virginia Beach — an area that usually leans Republican — by a wide, 6-point margin.

Size of Lead Circle size is proportional to the amount each county’s leading candidate is ahead.

Mr. Northam improved on Mrs. Clinton’s performance in just about every part of the state. He outperformed her in both the white working-class areas where she struggled, and the well-educated areas where she excelled.

Shift From 2016 (compared to 2016 presidential election)

But Mr. Gillespie still fared well in white, rural, western Virginia. He ran far ahead of any recent Republican other than Mr. Trump, even winning decisive victories in counties that he had lost just three years ago in a much closer contest for Senate. The results looked more like the 2016 presidential election than any other recent election.