MEXICO CITY (Reuters) - Mexican President Enrique Pena Nieto said on Wednesday that if allegations were proven that the United States had spied on its southern neighbor, it would be "totally unacceptable."

During a visit to northern Mexico, Pena Nieto was asked for his views on a media report that the U.S. National Security Agency had spied on countries including Mexico.

"We have asked quite clearly, via the foreign ministry ... for an explanation from the government ... about possible spying," he told reporters in the border state of Chihuahua.

"And we want to know if this is the case, and if it so, it would obviously be totally unacceptable," he added, noting that relations with Washington remained cordial.

Claims that the NSA monitored internet traffic, especially in Colombia, Venezuela, Brazil and Mexico, were made in a Brazilian newspaper citing documents leaked by Edward Snowden, a fugitive former NSA contractor.

Earlier, Mexico's foreign ministry said it had asked Washington for an explanation about the report in the paper O Globo.

Separately, the Mexican government responded to a media report alleging that the prior administration had signed a contract in 2007 allowing the United States to install a system to monitor phone and internet communications in Mexico.

"The Attorney General is reviewing the documentation regarding this apparent agreement. We are going to verify if it exists and under what conditions," said Eduardo Sanchez, a spokesman for the Interior Ministry.

Emilio Gamboa, the Senate leader of Pena Nieto's Institutional Revolutionary Party, said the contract allegations needed to be thoroughly investigated.

"Friendship is made by cooperation, not by spying on us," Gamboa told reporters in Mexico City.

Former President Felipe Calderon, who left office last year, worked closely with the United States on security as he waged a bloody battle against Mexico's drug cartels that has claimed an estimated 70,000 lives since the start of 2007.

(Reporting by Alexandra Alper; Editing by Eric Beech)