RICHMOND, Va. - Presidential electors yesterday formally endorsed Barack Obama as the nation's 44th president.

Yesterday's voting was largely ceremonial, the results preordained by Obama's Nov. 4 victory over Republican Sen. John McCain. Obama won 365 electoral votes, to 173 for McCain.

With every state and the District of Columbia reporting, all members of the Electoral College had cast ballots in accordance with the popular votes in their states.

Obama takes office Jan. 20, becoming the nation's first black president.

More than 131 million voters cast ballots - the most ever in a presidential election. But Obama's election will not be complete until Congress tallies the outcome of yesterday's Electoral College vote at a joint session Jan. 6.

All 21 Pennsylvania electors voted for Obama after speeches by Gov. Rendell and others. The electors included union leaders; state, county and local elected officials; and Franco Harris, the Pittsburgh Steelers' Hall of Fame running back, who endorsed Obama in March.

"That was special," Harris said of his opportunity to cast an electoral vote. "I sign my name to a lot of things, but this was the most valuable thing I've ever signed my name to."

The noontime ceremony took place in the state House of Representatives' chamber in Harrisburg as hundreds looked on. The tradition is more than 200 years old.

New Jersey's electors delivered the state's 15 electoral votes to Obama in a ceremony at the Trenton War Memorial.

State elections officials said the event, which is usually held in a meeting chamber at the Statehouse and rarely draws a crowd, yesterday drew 1,500 spectators who filled the auditorium and spilled into the balconies.

School buses lined the blocks outside, with hundreds of students attending the event along with a roster of Democratic Party officials.

The state's 15 electors took the stage to a rock-star welcome, greeted by a rousing standing ovation.

Gov. Corzine remarked on the diversity of the turnout and said he was proud that New Jersey had 500,000 newly registered voters this year.

"This year more young people, and people from the most diverse backgrounds, voted in record numbers, often for the very first time, because democracy is alive and well in our country," he said.

Similar ceremonies took place throughout the country as a total of 538 electors convened, most at their state capitols. In a few states, yesterday was the first time Democratic electors cast ballots in more than 30 years.

Obama was the first Democratic presidential candidate to win in Virginia and Indiana since Lyndon B. Johnson in 1964 and the first Democrat to win in North Carolina since Jimmy Carter in 1976.

In North Carolina, elector Janice Cole said that yesterday's event was a joyous marker for black people to put old Dixie's troubled past behind them. Obama, she said, "reminds us that only in America could this story be possible."

This article includes information from Bloomberg News.