Believing that the Reform Movement still had a chance to achieve success, Mabini did not immediately support the revolution of 1896. When José Rizal was executed in December that year, however, he changed his mind and gave the revolution his wholehearted support. In 1898, while vacationing in Los Baños, Laguna, Emilio Aguinaldo sent for him. It took hundreds of men taking turns carrying his hammock to portage Mabini to Kawit. Aguinaldo, upon seeing Mabini's physical condition, must have entertained second thoughts in calling for his help. Mabini was most active in the revolution in 1898, when he served as the chief adviser for General Aguinaldo. He drafted decrees and crafted the first ever constitution in Asia for the First Philippine Republic, including the framework of the revolutionary government which was implemented in Malolos in 1899. Prime Minister of the Philippines Apolinario Mabini was appointed prime minister and was also foreign minister of the newly independent dictatorial government of Aguinaldo on January 2, 1899. Eventually, the government declared the first Philippine republic in appropriate ceremonies on January 23, 1899. Mabini then led the first cabinet of the republic. Mabini found himself in the center of the most critical period in the new country's history, grappling with problems until then unimagined. Most notable of these were his negotiations with Americans, which began on March 6, 1899. The United States and the new Philippine Republicwere embroiled in extremely contentious and eventually violent confrontations. During the negotiations for peace, Americans proffered Mabini autonomy for Aguinaldo's new government, but the talks failed because Mabini’s conditions included a ceasefire, which was rejected. Mabini negotiated once again, seeking for an armistice instead, but the talks failed yet again. Eventually, feeling that the Americans were not negotiating 'bona fide,' he forswore the Americans, rallied the people, and supported war. He resigned from government on May 7, 1899.

He also joined the fraternity of Freemasonry. On December 10, 1899, he was captured by Americans at Cuyapo, Nueva Ecija, but was later set free. In 1901, he was exiled to Guam, along with scores of revolutionists Americans referred to as 'insurrectos' and who refused to swear fealty to imperialist America. When Brig. Gen. Arthur C. MacArthur, Jr. was asked to explain by the US Senate why Mabini had to be deported, he cabled: “ Mabini deported: a most active agitator; persistently and defiantly refusing amnesty, and maintaining correspondence with insurgents in the field while living in Manila, Luzon... ” Mabini returned home to the Philippines in 1903 after agreeing to take the oath of allegiance to the United States on February 26, 1903 before the Collector of Customs. On the day he sailed, he issued this statement to the press: “ After two long years I am returning, so to speak, completely disoriented and, what is worse, almost overcome by disease and sufferings. Nevertheless, I hope, after some time of rest and study, still to be of some use, unless I have returned to the Islands for the sole purpose of dying. ” To the chagrin of the American colonial officials, however, Mabini resumed his patriotic work of agitating for independence for the Philippines soon after he was back home from exile. On May 13, 1903 Mabini died of cholera in Manila, at the age of 38.