David Jesse, and Matt Helms

Detroit Free Press

With seven critical Genessee County precincts now reporting results, Donald Trump appears to have won Michigan by 13,225 votes -- a margin of less than three-tenths of a percent -- out of more some 4.8 million cast, according to unofficial results posted late this morning by the state.

Trump held a 12,488-vote lead over Hillary Clinton through the morning. But with all 83 Michigan counties reporting, Trump won 2,277,636 and Clinton 2,264,361. Trump's margin of victory was exceedingly close: He won 47.6% compared to 47.33% for Clinton, according to state totals updated at 11:30 a.m. today.

The Associated Press has not yet called the race.

Those numbers include Wayne County, where Clinton won 517,022 votes compared to Trump's 228,313, numbers provided to the Free Press by the Wayne County Clerk's office show.

►Related: How Clinton lost 'blue wall' states of Michigan, Pennsylvania, Wisconsin

►Explanation: How the Free Press missed mark on Michigan projection for Clinton

►Henderson: President-elect Trump, the country needs you to lead us all now

► Editorial: Trump must jettison demagogic election rhetoric for healing to begin

Across the state, Trump used out-state and rural counties to build his lead. Clinton used Wayne, Washtenaw and Genesee counties — typically Democratic strongholds — to chip into the lead. Those three, along with Monroe County, were the last counties in the state to report numbers.

It was a stunning turnabout. Michigan in recent weeks became a surprise last-minute election battleground, even though less than a month ago polls gave Clinton what appeared to be a nearly insurmountable double-digit lead in the state.

As Trump settled down as the election loomed and Republicans initially wary of the volatile, politically inexperienced businessman came home to support their nominee, Clinton's lead narrowed considerably, dropping to 4 points in the latest Free Press poll last week. But that, too, may have missed the level of support for Trump in the state among voters in rural areas and disaffected working-class whites.

►Related: Riley: Election over, it's time now to heal America

►Related: Fractured Michigan GOP seeks to unite behind Trump

►Related: Cautious automakers congratulate Trump

►Related: 2016 Michigan election results

That narrowing of the race drew national attention as it appeared that Michigan — which last voted for a Republican nominee, George H. W. Bush, in 1988 but had long been considered a top target for Trump and his strategy of going after disaffected, white, working-class voters — was suddenly back in play.

Trump and his top surrogates made several visits to the state — ranging from a large rally at Freedom Hill Amphitheater Sunday in Sterling Heights and his closing appeal to voters after midnight Tuesday morning in Grand Rapids — as he worked to bust down Clinton's firewall.

Clinton responded with rallies of her own, talking to voters Friday at Detroit's Eastern Market and visiting the state again on Monday for a rally at west Michigan's Grand Valley State University. Her last-minute visits lead pundits to suspect her campaign was worried about losing the state. Yet privately, Clinton supporters were said to be cautiously optimistic about holding onto Michigan and the nation.

President Barack Obama visited Ann Arbor on Monday as well, giving a speech at the University of Michigan intended to lure millennials to the polls. According to CNN exit polls, it appeared she did win younger voters by a substantial margin. But those same exit polls showed Trump winning every other age bracket in Michigan and taking a 13-point lead among male voters compared to a 9-point lead Clinton had among women in the state.

Those exit polls also showed Trump winning white voters in the state by a 58%-35% margin — besting Republican Mitt Romney's margins in 2012.

Earlier in the night, a look at a majority of key precincts across the state by Free Press political analyst Kiska indicated that Clinton would win, maintaining a seventh-straight presidential cycle in which the Democrats were expected to hold Michigan. The Free Press called the state on the basis of that analysis, though at 7 a.m. the final votes hadn't been tallied.

Results from 80 key precincts showed Clinton with a slight lead and only slightly underperforming Obama's margin of victory in those same precincts four years ago.

Free Press staff writer Todd Spangler contributed to this report. Contact David Jesse at 313-222-8851 or djesse@freepress.com. Follow David Jesse on Twitter: @reporterdavidj