The US National Security Agency spied on emails, phone calls and text messages of the presidents of Brazil and Mexico, a Brazilian news programme has reported.

The report by Globo's Fantastico was based on documents that Guardian journalist Glenn Greenwald obtained from former NSA contractor Edward Snowden.

Mr Greenwald, who lives in Rio de Janeiro, was listed as a co-contributor to the report.

Fantastico showed what it said was an NSA slide dated June 2012 displaying passages of written messages sent by Mexican President Enrique Pena Nieto, who was still a candidate at that time.

In the messages, Mr Pena Nieto discussed who he was considering naming as his ministers once elected.

A separate slide displayed communication patterns between Brazilian President Dilma Rousseff and her top advisers, Fantastico said, although no specific written passages were included in the report.

Both slides were part of an NSA case study showing how data could be "intelligently" filtered by the agency's secret internet surveillance programmes that were disclosed in a trove of documents leaked by Mr Snowden in June, Fantastico said.

Brazil's government, already annoyed from earlier reports that the NSA spied on the emails and phone calls of Brazilians, called in US Ambassador Thomas Shannon to explain the new allegations that the agency had spied on Ms Rousseff herself.

Justice Minister Jose Eduardo Cardozo said the contents of the documents, if confirmed, "should be considered very serious and constitute a clear violation of Brazilian sovereignty".

"This [spying] hits not only Brazil, but the sovereignty of several countries that could have been violated in a way totally contrary to what international law establishes," he told O Globo newspaper.

Mr Cardozo travelled to Washington last week and met US Vice President Joe Biden and other officials, seeking more details on a previous, seemingly less serious set of disclosures by Mr Snowden regarding US spying in Brazil.

Ms Rousseff is scheduled to make a formal state visit in October to meet US President Barack Obama in Washington, a trip intended to illustrate the warming in Brazilian-US relations since she took office in 2011.

Mexico's presidential palace said it had no comment.

In July, after initial reports of NSA surveillance of internet communications in Latin American nations, Mr Pena Nieto said it would be "totally unacceptable" if it were revealed that the US had spied on its neighbour and largest business partner in the region.