The gunman who opened fire atop Mexico's ancient Pyramid of the Moon appeared to have been influenced by other violent shootings and showed signs of psychological problems, the country's president said on Tuesday.

Julio César Jasso Ramírez, 27, a Mexican national, carried a handgun, dozens of cartridges, a knife and literature referencing acts of violence, officials said on Tuesday.

Mexico's top prosecutor said Jasso Ramírez planned and carried out the attack alone. The gunman fatally shot himself after a standoff with police.

A Canadian woman was killed and 13 others were injured at the popular tourist site northwest of Mexico City.

Based on everything indicated by the prosecutorial authorities, this person showed signs of psychological problems and was influenced by incidents that occurred abroad, President Claudia Sheinbaum said during a Tuesday media conference.

The gunman carried documents that apparently referenced the 1999 Columbine High School massacre in the US, according to José Luis Cervantes Martínez, attorney general of the State of Mexico, which is home to the Teotihuacán pyramid complex.

A tourist who witnessed the shooting told Reuters news agency that visitors heard Jasso Ramirez refer to the notorious Columbine shooting, which took place exactly 27 years prior.

This act was not spontaneous, said Cervantes Martínez.

After the gunman scaled the ancient pyramid, he began shooting from one of its platforms. Videos recorded by tourists there showed the gunman making threats as visitors tried to make their way to safety. Several shots are heard; a 32-year-old Canadian tourist was shot dead in the incident.

A National Guard member and a municipal police officer who were called to the scene scaled the pyramid to corner him, said Cervantes Martínez, Mexico's top prosecutor.

The gunman fired 14 times at the victims and the responding officers, and was shot in the leg by the national guardsman as they attempted to immobilise him. Then Jasso Ramirez took his own life.

The site, which attracted about 1.8 million visitors last year, will reopen on Wednesday with reinforced security, Sheinbaum said.

Looking ahead to the summer's World Cup football matches, Sheinbaum vowed to guarantee safety during the global football event, which kicks off on 11 June in Mexico City. It is safe to be in Mexico, she added, noting that 16 million foreign visitors arrived between January and February.