Many of the victims had travelled from Central and South America trying to get to the US.
The fire at the centre in Ciudad Juárez broke out shortly before 22:00 local time (04:00 GMT).
The city, located across the Rio Grande river from El Paso, Texas, has seen an influx of people in recent weeks.
Many have been heading to the US border in expectation of an end to Title 42, a pandemic-era policy which gives the US government the power to quickly expel migrants trying to cross its border.
Mexican President Andrés Manuel López Obrador said migrants had set mattresses ablaze.
“It was related to a protest they started, we think, when they learned that they’d be deported,” the president said, adding that the migrants had set alight mattresses.
“They didn’t think that would cause this terrible tragedy,” he added.
Photos from the scene show body bags lined up on the pavement outside.
Local media say the migrants inside the building where the blaze happened had been picked up by the authorities on Monday and taken to the centre. The facility is located near the Stanton-Lerdo Bridge, which links Mexico and the US.
Twenty-nine people were also injured in the blaze. Some 68 men from Central and South America were inside the centre run by Mexico’s National Migration Institute (INM) when the fire happened.
Mexican authorities said the dead and injured included people from Guatemala, Honduras, Venezuela, El Salvador, Colombia and Ecuador.
Twenty-eight Guatemalan citizens were killed in the fire, the country’s foreign minister Mario Bucaro told reporters.
UN Secretary-General Antonio Guterres called for a “thorough investigation” into the incident.
A spokesman said Mr Guterres would “continue working with the authorities of countries where mixed movements of people occur to establish safer, more regulated, and organised migration pathways”.
The US ambassador to Mexico, Ken Salazar, said the tragedy was “a reminder to the governments of the region of the importance of fixing a broken migration system and the risks of irregular migration”.
Title 42, which allows US border officials to deny individuals entry to the US “to prevent the spread of communicable disease” was first implemented at the start of the Covid pandemic.
The Biden Administration has announced its intention to end the use of the Trump-era policy but for now it remains in place.
Since the announcement, the number of migrants in Ciudad Juárez awaiting the possible lifting of the restrictions has swelled.