After participating in the U.S.-Mexican War defending his country as a volunteer, he studied medicine in Paris (1847–1851). There he became acquainted with Auguste Comte's doctrine of positivism, before his first publications in philosophy. Upon returning to Mexico City, he introduced the positivistic school, and taught in Guanajuato (1863–67) until the fall of the Maximilian empire.
In 1867, he headed the educational commission of President Benito Juárez, where he was able to implement Comte's positivism in higher education. The commission established the National Preparatory School (Escuela Nacional Preparatoria (ENP)), where he served director for a decade. Because Barreda was closely associated with Juárez and his successor following his death, Sebastián Lerdo de Tejada, the Díaz regime forced him out from the ENP in 1878, to be Mexican ambassador to the German Empire, a prestigious post, but far from the action of Mexican power. Barreda influenced many traditionalist thinkers during the Porfirian regime.
To this day, he is acknowledged as an important figure of education in Mexico, one of the fathers of the Universidad Nacional Autónoma de México and the undergraduate medal for the top student of each major's class is named in his honor.