For the fifth time in 100 years, Vietnam is facing the prospect of being involved in a war with a larger, more powerful country. The country that took on the Central Powers, Japan, France, the United States, and China is facing the possibility of conflict with a familiar foe: China.

As Beijing presses territorial claims in the South China Sea, Vietnam is arming itself for a potential air and sea confrontation with its larger neighbor. Despite the difference in size between the two nations, particularly in terms of military power, Vietnam is not backing down.

Vietnam went to war five times during the 20th century. In World War I, Vietnamese troops served on Europe’s Western Front as part of France’s colonial forces. Vietnamese troops fought Japanese occupation forces in World War II, the French and American military between 1945 and 1972, and, briefly, China in 1979.

Perhaps improbably, Vietnam won — or avoided losing — every time.

China and Vietnam are two neighbors that historically do not get along. Vietnam has suffered political, military, and cultural domination from China for thousands of years.

Now, China is pressing territorial claims in the South China Sea. It deposited an oil rig in Vietnam’s Exclusive Economic Zone, claiming it was in Chinese territory, and is now in the process of building up artificial islands to strength its claims over 90 percent of the South China Sea, Vietnam’s front yard.

Unlike most countries in Asia, Vietnam has matched China’s defense spending increases the best it could, increasing its own drastically over the last 11 years. The amount Vietnam spends on defense increased 113 percent between 2004 and 2013.

Despite the increase, the difference is vast: Vietnam spent approximately $3.2 billion on defense in 2013; China $114 billion.

Still, for Vietnam all is not lost. China has to deal with a host of traditional enemies, such as India, Japan, and Vietnam, and unstable rogue states including Afghanistan, North Korea, and Pakistan. China’s security situation is much more complex. Vietnam essentially has to defend against one neighbor: China.

Furthermore Vietnam, which spends less than $100 per person in the armed forces, cannot afford to spend a lot on defense. But Vietnam does not have to budget to win: Once again, it merely has to avoid losing.

Unlike Vietnam’s past conflicts, any future war would likely be confined to air and sea. China, which in 1979 lost 9,000 ground troops in a month invading Vietnam, has little interest in a repeat scenario. China’s One Child Policy means that in the modern era, 9,000 Chinese killed in war produce 9,000 angry, childless families.

Instead, it would likely rely on the Chinese Air Force and Navy. The government has spent an enormous amount of money modernizing China’s air and naval forces. It’s also easier to escalate or de-escalate a conflict confined to the air and sea.

To counter China’s air and naval buildup, Vietnam has channeled its spending increase into new ships and planes. In 2007, Vietnam bought six Kilo-class submarines from Russia. Nicknamed “black holes” in Russian service, the Kilo class are known for running quietly. Vietnam has also bought Gepard-class frigates from Russia, coastal defense missile batteries, modern surface to air missiles, and upgraded the Vietnamese Air Force with modern 24 Sukhoi Su-30 fighters. Vietnam’s strategy is to make it too dangerous to attack.

Perhaps not surprisingly, Vietnam’s confrontation with China has attracted patrons. The United States, India, and Japan, seeking to reign China in, have made overtures to Vietnam. The United States is looking to sell maritime patrol planes to Vietnam, while Japan is providing ships. India is training submariners for Vietnam’s fleet of brand-new submarines.

So far, Vietnam has kept potential allies at arms’ length. All of that may change depending on the course of Vietnamese-Chinese relations. If China were to continue to escalate its claims in the South China Sea, or start an extended buildup versus Vietnam, the latter may be compelled to seek stronger defense ties.

All of this is not to suggest that war between Vietnam and China is a sure thing. Economic activity between the two countries is at an all-time high, reaching $50 billion in 2013, and China is Vietnam’s largest trading partner. There are a lot of people benefiting from peace between the two countries. Let’s hope their interests edge out those who are willing to roll the dice and start a war.