The fire began Monday night at a facility run by the National Migration Institute in Ciudad Juarez, the agency said in a statement.
Dozens more were injured, with 29 people taken to four local hospitals in “delicate-serious condition,” it said, adding that there were 68 men from Central America and South America being held in the facility during the time of the fire.
Images showed rows of bodies laid out under silver sheets as rescue teams, firefighters and local police responded to the scene.
The cause of the fire was not immediately known. The agency said that it “strongly rejects the acts that led to this tragedy,” without elaborating on what those might have been.
Authorities were investigating and the government’s National Human Rights Commission had been called in to help the migrants, it said.
The facility, in Chihuahua state, is close to the Santa Fe International Bridge and across the border from El Paso, Texas.
The country’s prosecutor general has initiated an investigation, Andrea Chávez, federal deputy of Ciudad Juarez, said in a statement on Facebook. Consular teams were also being engaged to identify the deceased, officials said.
Mexican authorities did not immediately respond to requests for further comment.
Ciudad Juarez is a major crossing point for migrants attempting to make the journey across the border to the United States.
Its shelters there are full of migrants waiting for opportunities to cross or who are waiting out the asylum process.
In recent years, as Mexico has stepped up efforts to stem the flow of migration to the U.S. border under pressure from Washington, its National Immigration Institute has struggled with overcrowding in its facilities.
Jay Varela and Associated Press contributed.