President Biden signed legislation on Thursday to make Juneteenth a federal holiday, enshrining June 19 as the national day to commemorate the end of slavery in the United States.

“All Americans can feel the power of this day, and learn from our history,” Mr. Biden said at a ceremony at the White House, noting that it was the first national holiday established since Martin Luther King’s Birthday in 1983.

He said signing the law was one of the greatest honors he will have as president.

The law went into effect immediately, making Friday the first federal Juneteenth holiday. Public schools were closed on a moment’s notice. The federal Office of Personnel Management announced that most federal employees would observe the holiday on Friday, since June 19 falls on a Saturday this year. At the White House, officials canceled the daily press briefing and pulled down normal meetings for Friday.

The Nasdaq Stock Market said U.S. markets, however, were expected to remain open on Friday.

The Senate rushed the measure through with no debate this week after clearing away a longstanding Republican objection, and the House approved it on Wednesday by a vote of 415 to 14, with all of the opposition coming from the G.O.P.