Bill and Hillary Clinton will attend Donald Trump’s inauguration on Jan. 20, a spokesman said, setting aside any Election Day disappointment to witness the transfer of power.

Mrs. Clinton has kept a low profile since losing the presidential election to Mr. Trump. She gave a speech to the Children’s Defense Fund about a week after her defeat and acknowledged that her decision to appear “wasn’t the easiest.”

Mr. Trump and Mrs. Clinton waged a tough campaign. She described him as “temperamentally” unfit for the job, while the incoming president referred to her as “crooked Hillary.”

In comments after the election, Mr. Trump backed away from fiery campaign rhetoric in which he pledged to appoint a prosecutor to probe Mrs. Clinton’s email server and Clinton Foundation work.

“I don’t want to hurt the Clintons, I really don’t,” Mr. Trump said in an interview with the New York Times in late November.