Peru has ordered the Mexican ambassador to leave within 72 hours after Mexico granted asylum to the family of ousted Peruvian President Pedro Castillo.
Mr Castillo was removed from office earlier this month after he tried to dissolve Congress.
He is being investigated in Peru on charges of rebellion and conspiracy.
But Mexico has been supportive of the ousted president, and said early on that it was considering granting him asylum.
Mexican President Andrés Manuel López Obrador has called the removal of Mr Castillo undemocratic.
Mexican Foreign Minister Marcelo Ebrard said on Tuesday the government was negotiating safe passage for the family of Mr Castillo, who were inside Mexico’s embassy in the Peruvian capital Lima.
His Peruvian counterpart, Ana Cecilia Gervasi, said safe passage had been granted.
But Mexico’s decision to grant asylum caused further anger in Peru, and Mexican Ambassador Pablo Monroy has now been declared “persona non grata” by the government.
Peru’s foreign ministry said in its social media accounts that it was expelling Mr Monroy because “of the repeated statements by that country’s highest authorities about the political situation in Peru”.
Peruvian opposition legislator Maria del Carmen Alva accused Mexico of “sheltering the corrupt”.
Mr Castillo, who is in custody in Peru, was removed from office after he tried to dissolve Congress.
Facing an impeachment vote, Mr Castillo had announced he was dissolving the opposition-controlled legislative body.
But Congress defied him, voted overwhelmingly to remove him from office, and his bodyguards stopped him from seeking refuge at the Mexican embassy in Lima.
Just hours later, Congress swore in his vice-president, 60-year-old Dina Boluarte, as the new president.
She has been pushing for early elections, and they edged closer on Tuesday as lawmakers voted in favour of the proposals.
This would bring elections forward to April 2024, two years ahead of elections currently scheduled for 2026.
There have been violent protests in which demonstrators have called for fresh general elections. Supporters of Mr Castillo have also taken to the streets to demand his release.