Boston Mayor Marty Walsh was confirmed Monday by the Senate as secretary of labor, setting the stage for him to take the reins of an agency that is central to President Biden’s worker-friendly agenda.

Walsh (D), 53, a friend of the president’s who was a favored candidate of organized-labor groups such as the AFL-CIO, will be the first labor secretary to come from a union background in nearly 50 years.

He rose to prominence in Boston through the building-trades unions after dropping out of college early to work in construction. He also served in the Massachusetts House of Representatives.

Walsh’s nomination was relatively uncontroversial. He was approved on a 68-to-29 vote.

During a mostly amicable confirmation hearing, he was asked repeatedly by senators on the Health, Education, Labor and Pensions Committee about disparities for women and people of color in areas such as unemployment during the coronavirus pandemic, wages and earnings, and health care.

“We are dealing with a system of systemic racism that we have to continue to address,” Walsh said at the hearing. “It’s not simply just throwing fancy words out there, but in policies, it’s actually doing the work, rolling up our sleeves.”

Walsh has supported labor policies including the Protecting the Right to Organize Act, a proposal that the House passed last year to update labor laws and give employees more ability to organize at work. He also has supported efforts to raise the minimum wage.

Walsh will inherit a Labor Department navigating a complicated economic and public health crisis, with an estimated 18 million workers collecting unemployment benefits and others who have left the workforce since last year. He will oversee agency decisions about the proper level of safety compliance necessary for workplaces during the pandemic. Walsh also will face other challenges that predate the pandemic, such as how to regulate contract and gig work.

Under President Donald Trump, the agency passed rules that exempted a large number of workers from the paid sick-leave requirements in the Families First Coronavirus Response Act and issued strict guidelines for unemployment insurance payouts to gig and self-employed workers that labor advocates and workers considered restrictive.

The department’s workplace safety division, the Occupational Safety and Health Administration, has drawn particular ire for doing little to enforce safety standards for workplaces during the early days of the pandemic — the worst occupational health crisis in modern times.