WASHINGTON — Democrats counted their New Year’s blessings on Wednesday as two new senators — Doug Jones of Alabama and Tina Smith of Minnesota — joined their caucus, reshaping the balance of power in the Senate after a history-laden swearing-in ceremony attended by three current and former vice presidents.

The arrival of Mr. Jones, who replaced a Republican (Ms. Smith replaced a Democrat) alters the makeup of the Senate, giving Republicans a one-vote majority of 51 to 49. That could prove just enough to thwart much of President Trump’s legislative agenda.

It also provided the first tangible boost to Democratic power in Washington since the crushing and unexpected defeats of Election Day 2016, which many Democrats had believed would usher in a new Democratic president and a Democratic Senate.

“This is a miracle — to have a Democratic senator from Alabama!” Senator Richard J. Durbin of Illinois, the No. 2 Democrat in the Senate, said after mingling at a reception for Mr. Jones.