Barrios was born in the village of San Lorenzo, in the Departamento of San Marcos, Guatemala. Barrios was known from his youth for his intellect and energy, went to Guatemala City to study law, and became a lawyer in 1862. In 1867 revolt broke out in western Guatemala, which many residents wished to return to its former status of an independent state as Los Altos. Barrios joined with the rebels in Quetzaltenango, and soon proved himself a capable military leader, and in time gained the rank of general in the rebel army. In July of 1871 Barrios, together with other generals and dissidents, issued the "Plan for the Fatherland" proposing to overthrow Guatemala's long entrenched Conservativo administration; soon after they succeeded in doing so, and General Garcia Granados was declared president and Barrios commander of the armed forces. While Barrios was back in Quetzaltenago, Garcia Granados was overthrown by a revolt. Barrios again marched on the capital and became the new president. The Conservative government in Honduras gave military backing to a group of Guatemalan Conservatives wishing to take back the government, so Barrios declared war on the Honduran government. At the same time Barrios, together with the President of El Salvador, declared an intention to reunify the old United States of Central America.
Barrios instituted a number of reforms, including freedom of the press and religion. He was elected President in May of 1873.
Barrios oversaw substantial cleaning and rebuilding of Guatemala City, and set up a new and accountable police force. He brought the first telegraph lines and railroads to the Republic. He established a system of public schools in the country.
In 1879 a constitution was ratified for Guatemala (the Republic's first as an independent nation, as the old Conservativos regime had ruled by decree). In 1880 Barrios was reelected President for a 6 year term. Barrios unsuccessfully attempted to get the United States of America to mediate the disputed boundary between Guatemala and Mexico.
Guatemala, El Salvador, and Honduras agreed to reform the Central American Union, but then Salvadorian President Zaldivar decided to withdraw from the Union, and sent envoys to Mexico to join in an alliance to overthrow Barrios. Mexican President Porfirio Diaz feared Barrios' liberal reforms and the potential of a strong Central America as a neighbor if Barrios' plans bore fruit. Diaz sent Mexian troops to seize the disputed land of Chiapas and Soconusco. Meanwhile Barrios was personally leading the army into El Salvador, where he was killed at Chalchuapa, El Salvador. Much of the hopes for a reunited Central America died with him.