The storm, packing maximum sustained winds of 120 kilometres (75 miles) per hour, hit land in the state of Chiapas, a rural region with archeological sites near the neighboring state of Oaxaca, the US National Hurricane Centre said.
The US man "was dragged by the waves and died" after he ignored a ban on entering the beach in the town of Salina Cruz in Oaxaca, state civil protection director Manuel Maza told AFP.
The second victim was a 27-year-old man who was swept away by an overflowing river in the Oaxaca town of Pinotepa Nacional, Mayor Carlos Sarabia said.
In Oaxaca, authorities had urged residents to stay home, while the ports of Salina Cruz, Huatulco, Puerto Angel and Puerto Escondido were shut down. Some 200 families were taken to shelters, officials said.
More From This Section
Barbara grew into a category one hurricane -- the lowest on the five-level Saffir-Simpson scale -- before making landfall 35 kilometers (20 miles) west of the Chiapas town of Tonala, the US hurricane center said.
Mexico's National Water Commission warned that Barbara's winds could affect the neighboring states of Chiapas, Tabasco, Campeche, Yucatan, Quintana Roo, Veracruz and Guerrero.
The storm was moving toward the northeast at 15 kmph (nine mph), the US hurricane center said. Tropical force winds extend outward up to 110 kilometres (70 miles) from the storm's center.
Barbara was forecast to dump up to 25 centimeters (10 inches) of rain over parts of Oaxaca and Chiapas, with as much as 50 centimeters (20 inches) possibly falling in isolated areas of southeastern Oaxaca, the center said.
In March 2012, two girls died and 25,000 homes were affected when Hurricane Carlotta tore across Oaxaca.