To look at a map of South America, one can more or less see from the start that Paraguay doesn't need to be picking any fights, let alone with its two largest and most powerful neighbors, Argentina and Brazil. However, that's just what they did from 1864 to 1870. Paraguay was at the time being led by a dictator, though, to whom the people were suicidally loyal, Francisco Solano Lopez, so whatever he said pretty much went.
Paraguay's relations with its neighbors Argentina and Brazil had been worsening for some time before the outbreak of war. Brazil was still mad that Lopez's father and predecessor, Carlos Antonio Lopez, hadn't helped them remove the Argentinian dictator Juan Miguel de Rosas in 1852. Brazil also wasn't too happy about having been forced to remove troops from areas that Paraguay claimed in both 1850 and 1855. In fact, both Brazil and Argentina were eyeing pieces of Paraguay on their respective borders as either potential conquests or rightfully theirs to begin with. Additionally, Paraguay was still upset about being made to grant free navigation rights on the Rio Paraguay in the time of Lopez's father. The three had generally been fighting diplomatically over many mundane boundary and tariff matters for quite some time before the war, and Lopez had at some point deemed it necessary to set up the largest army in South America, some 30,000 men strong. Two needs probably motivated the military buildup. On the one hand, there was a legitimate need for protection from the stronger regional powers who had a tendency to disregard the rights of lesser states and attempt to control their internal affairs to the larger states' benefit, but on the other hand, Lopez probably just felt better about his very small country's place in the world when he had the largest army on the continent. In the end, although he had the largest army to begin with, he had no reserves to draw upon, few competent high-ranking military personnel, no industrial base to make weapons, and a relatively tiny number of people. These mistakes coupled with Lopez's leadership style (think of a rhinoceros trying to escape a zoo by repeatedly bashing his head into the wall of the cage, periodically pausing to punch itself in the face from frustration) sealed Paraguay's fate almost from the start.
In 1864, the Brazilian government stuck its military hand into the internal affairs of Uruguay, ousting the Blanco party candidate for president in favor of the Colorado party candidate, essentially making Uruguay into a Brazilian puppet state. Francisco Lopez did not like this one bit. He thought it upset the regional balance of power in favor of an already-powerful Brazil, so he declared war on them in 1864 and seized a Brazilian warship before invaded the Brazilian province of Mato Grosso in March, 1865. Argentina, who had seen it all coming, tried to ride this one out by declaring themselves neutral, but Lopez demanded that they allow him to send Paraguayan troops through the Argentinian province of Corrientes on their way to Brazil's province, Rio Grande do Sul. They denied his request and he sent his troops through anyway, probably expecting Argentinian locals, with whom he had had prior contact and probably collaboration during the days of his conflicts with Rosas, to rebel against Argentina in support of him, thereby removing Argentina from military consideration. They didn't, however, and Argentina's president, Bartolome Mitre, responded by organizing an alliance against Paraguay between themselves, Uruguay, and Brazil: the titular Triple Alliance.
What Paraguayans lacked in numbers and chances of winning, they tried to make up for with good old moxie. The troops exhibited suicidal tendencies throughout the war, whether that meant attacking Brazilian ironclad riverships with just machetes or simply staying in the Paraguayan army until executed or tortured by Lopez's extremely harsh military justice. Lopez treated his men horribly, executing them on the slightest breach of orders and sending them to die left and right. When the original army was killed, another was called up to replace it. By 1867, Paraguay had lost its first 30,000 men, plus another 30,000, whereupon they called up another 60,000 troops. When they ran out of people, they turned to other sources: slaves, children, and women, although the latter usually took up only non-military labor. The suicide attacks, self-flagellation, and insane bravery would ultimately do no good for Paraguay, though.
Unfortunately for the Paraguayans, the allied troops soon outnumbered them by around ten to one. Not only that, but about half of Paraguay's vaunted 30,000 man force had been killed or captured, along with many of the army's best weapons, during their first abortive assault on Brazil. This fact, coupled with logistical troubles, forced Paraguay to withdraw its forces behind its own frontiers, and from then on Paraguay was on the defensive in the war. The rivers leading to Paraguay, its main avenue to the rest of the world from its landlocked position, were blockaded by the Alliance starting in January of 1866. Shortly thereafter, the Argentinian president Mitre, then military commander-in-chief of the alliance, sent troops into southwest Paraguay, where they engaged the enemy in a fruitless stalemate for about two years. They were kept from advancing by the Paraguayans most notably at the battle of Curupayty, in September of 1866, where they were kept from advancing for quite some time.
President Mitre was seen as something of a conquest-oriented leader, especially by the Argentinians. He was replaced in 1868 by the Brazilian Marquis de Caxias, who would later earn a dukedom for his trouble. Under his leadership, Brazilian river ships broke through the defenses at Humaita in February. They went up the river to Asuncion, the capital of Paraguay, which they bombarded fairly extensively. The Paraguayans were kept on the defensive until the killing blow came in December of the same year, when a major Alliance campaign almost completely wiped the entire army out. Francisco Lopez fled to the northern part of the country with the remnants of his army, where he continued to fight the Alliance unsuccessfully using guerrilla tactics until he was killed on March 1, 1870.
Lopez's death was probably good for Paraguay. Aside from the fact that he had gotten them into an incredibly difficult war that they had virtually no hope of winning, he also had the aforementioned tendency to torture and execute his own countrymen. Toward the end of the war, this got especially bad. Imagining a huge conspiracy against himself, he began executing people wholesale, usually using a lance thrust rather than shooting them to save ammunition. He executed two of his brothers, two brothers in law, at least 500 foreigners, including some diplomats, and unnamed large quantities of army and governmental officials.
His death pretty much ended the war, although the war itself came pretty close to ending Paraguay. Out of their starting population of around 525,000 people, only about 221,000 were still alive at the end of it. Of those, about 28,000 were men. The country didn't just lose people, either. Argentina took a hefty chunk of the Chaco and Misiones regions, and Brazil decided to beef up its Mato Grosso region by incorporating major portions of Paraguay. They also occupied Paraguay until 1876, all the time demanding a huge indemnity. They must have eventually given up, realizing that you can't squeeze blood from a stone, because the indemnity never was paid. Needless to say, Paraguay had a hard time recovering.
This war, the bloodiest in the history of South America, killed an estimated 424,000 people, 304,000 of which were Paraguayans. It's also sometimes known as the Paraguayan war and the first Chaco war.
Sources: http://www.onwar.com/aced/nation/bat/brazil/ftriple1864.htm,http://www.state.gov/www/background_notes/paraguay_0799_bgn.html, http://lcweb2.loc.gov/cgi-bin/query/r?frd/cstdy:@field(DOCID+py0021)