Machado managed to rise in his bureaucratic career, first in the Agriculture Department. Three years later, he became the head of a section in it. He published two poetry books: Falenas, in 1870, and Americanas, in 1875. Their weak reception made him explore other literary genres.

He wrote five romantic novels: Ressurreição, A Mão e a Luva, Helena and Iaiá Garcia. The books were a success with the public, but literary critics considered them mediocre. Machado suffered repeated attacks of epilepsy, apparently related to hearing of the death of his old friend José de Alencar. He was left melancholic, pessimistic and fixed on death. His next book, marked by "a skeptical and realistic tone": Memórias Póstumas de Brás Cubas (Posthumous Memoirs of Brás Cubas, also translated as Epitaph of a Small Winner), is widely considered a masterpiece. By the end of the 1880s, Machado had gained wide renown as a writer.

Although he was opposed to slavery, he never spoke against it in public. He avoided discussing politics. He was criticized by the abolitionist José do Patrocínio and by the writer Lima Barreto for staying away from politics, especially the cause of abolition. He was also criticized by them for having married a white woman. Machado was caught by surprise with the monarchy overthrown on 15 November 1889. Machado had no sympathy towards republicanism, as he considered himself a liberal monarchist and venerated Pedro II, whom he perceived as "a humble, honest, well-learned and patriotic man, who knew how to make of a throne a chair, without diminishing its greatness and respect." When a commission went to the public office where he worked to remove the picture of the former emperor, the shy Machado defied them: "The picture got in here by an order and it shall leave only by another order."

The birth of the Brazilian republic made Machado become more critical and an observer of the Brazilian society of his time. From then on, he wrote "not only the greatest novels of his time, but the greatest of all time of Brazilian literature." Works such as Quincas Borba (Philosopher or Dog?) (1891), Dom Casmurro (1899), Esaú e Jacó (1904) and Memorial de Aires (1908), considered masterpieces, were successes with both critics and the public. In 1893 he published "A Missa do Galo" ("Midnight Mass"), considered his greatest short story.
Give me the best books wrote by Machado de Assis
Memórias Póstumas de Brás Cubas, Quincas Borba, Dom Casmurro, Esaú e Jacó, Memorial de Aires and A Missa do Galo