Pena Nieto said he had accepted Videgaray's resignation and replaced him with Social Development Minister Jose Antonio Meade, a former foreign minister who held the finance job between 2011-2012.
Pena Nieto, flanked by both men at the presidential residence of Los Pinos, praised Videgaray as a public servant who has been "committed to Mexico and loyal to the president."
The Mexican leader made no mention of reports that Videgaray played a crucial role in setting up US presidential candidate Trump's August 31 meeting with Pena Nieto, which drew scorn in the country.
Videgaray, an economist who earned a doctorate from the prestigious Massachusetts Institute of Technology (MIT), saw the meeting as a political risk that was worth taking, in case Trump was elected, the Post said.
More From This Section
Videgaray was reportedly the behind-the-scenes liaison to the Trump campaign.
Trump's visit backfired on the president, with Mexicans voicing outrage that a US politician who has branded Mexican migrants as "rapists" would get such a prestigious invitation.
More than 88 percent of Mexicans expressed displeasure at Trump's visit, according to a survey by the Mitofsky polling firm.
"I suppose it has to do with the fact that the political cost for the president has been very high," Ugalde told AFP.
Videgaray's role compromised his ability to negotiate the budget with the Congress, he said.
Trump said at a press conference after the meeting that his demand that Mexico pay for a wall along the border had not been discussed.
Pena Nieto, who was criticized for not challenging Trump at the joint press conference, later said that he had told the Republican candidate that his government would not pay for the wall.
Videgaray coordinated Pena Nieto's presidential campaign and has been known as one of his key advisers over the years.
But the economy has not performed as well as hoped, shrinking by 0.3 percent in the second quarter, while the peso has dropped against the dollar.