Republican electors in Texas vaulted Mr. Trump past the 270 mark, granting him all but two of their 38 ballots in a ceremony in the State Capitol in Austin.
In the House chamber, where the electors met, the vote was greeted with a standing ovation by citizens and Republican officials who had come to witness the event. Outside, perhaps 100 protesters waved placards and chanted “Save our democracy” in a vain effort to persuade electors to reject the Republican nominee.
Normally a political footnote, the electoral vote acquired an unexpected element of drama this winter after Mr. Trump’s upset of Hillary Clinton, who received 2.86 million more popular votes but won in states that totaled only 232 electoral votes. The states Mr. Trump won held 306 electoral votes.
While Mr. Trump’s opponents needed 37 Republican defectors to bring his electoral-vote tally below 270, the bulk of electors who broke ranks — four in Washington State — were Democrats who otherwise would have voted for Ms. Clinton. Instead, they voted for the former Republican secretary of state Colin L. Powell and Faith Spotted Eagle, a Native American tribal leader who has led opposition to the Keystone XL pipeline. Elsewhere, Democratic electors who sought to vote for someone besides Mrs. Clinton switched back to her under pressure or were replaced with Clinton supporters.
In Texas, two Republican electors cast protest votes, one each for Ron Paul and Gov. John Kasich of Ohio. One other Republican opposed to Mr. Trump resigned and was replaced.
A strategy memo by the anti-Trump forces has estimated that as many as 34 Republican electors were prepared to vote for someone besides Mr. Trump, but also said many were afraid of the consequences and suggested that a poor turnout of other anti-Trump electors would weaken their resolve.
That appears to have been the case in Texas, where more defections were expected, said Ryan Clayton, the leader of Americans Take Action, a group opposed to Mr. Trump. “When they saw the trend line, they just decided to get out of the way of the electoral Alamo that was taking place,” Mr. Clayton said.
That left most of the opposition to demonstrators who protested outside and inside electoral voting sites in most if not all 50 states.
In Michigan’s capital, Lansing, opposition protesters chanted: “Vote your conscience! Follow your heart!” and sang “We Shall Overcome” inside the State Capitol as Republican electors gave all 16 of the states votes to Mr. Trump.
In Kentucky’s state Supreme Court chambers, protesters silently watched electors give the state’s eight votes to Mr. Trump as another 50 to 100 demonstrators stood outside.