Almost as soon as the Second World War ended, a new rivalry took its place. The Cold War, lasting roughly from 1947 to 1991, pitted the United States and its allies against the Soviet Union and its bloc, a contest waged through politics, propaganda, and proxy wars rather than direct combat. The Truman Doctrine of 1947 committed the United States to containing communism by supporting threatened countries, and the Marshall Plan of 1948 channeled American aid to rebuild Western Europe. In 1949, the United States and its allies created the North Atlantic Treaty Organization (NATO); the Soviet bloc answered in 1955 with the Warsaw Pact. As Europe hardened into two camps, the decolonization movement transformed much of the rest of the world: India gained independence on August 15, 1947, led by Mahatma Gandhi and Jawaharlal Nehru, though partition into India and Pakistan caused enormous violence and mass migration, and the People's Republic of China was proclaimed on October 1, 1949, under Mao Zedong.
The Cold War produced several brushes with nuclear catastrophe. The Korean War (1950–1953) ended in a stalemate on the peninsula, and the Hungarian Revolution of 1956 and the Prague Spring of 1968 were both crushed by Soviet tanks, demonstrating Moscow's determination to hold its empire together. In 1959, Fidel Castro overthrew Batista in Cuba, prompting the failed CIA-backed Bay of Pigs invasion in 1961 and, in 1962, the Cuban Missile Crisis, a thirteen-day nuclear standoff resolved when the Soviets withdrew their missiles. Germany became the most visible front of the rivalry: the Berlin Wall went up in 1961 and fell in 1989, a moment whose symbolism was lost on no one. The space race climaxed on July 20, 1969, when Neil Armstrong and Buzz Aldrin of Apollo 11 became the first humans to walk on the Moon.
Outside Europe, decolonization often came through war or upheaval. France was defeated at Dien Bien Phu in 1954, and Vietnam was divided, leading to a long conflict in which the United States intervened until Saigon fell on April 30, 1975. Algeria won independence from France in 1962, the Organization of African Unity was founded in 1963, and a wave of new states emerged across Africa and Asia. Mao's domestic campaigns, the Great Leap Forward (1958–1962) and the Cultural Revolution (1966–1976), caused famine and upheaval on a vast scale, and the Tiananmen Square protests of 1989 ended in a brutal crackdown. In the United States, the civil rights movement, symbolized by the life and 1968 assassination of Martin Luther King Jr., achieved landmark legislation in the Civil Rights Act of 1964, while in South Africa, the system of Apartheid (1948–1994) institutionalized racial segregation until Nelson Mandela, released from prison in 1990, was elected the country's first Black president in 1994. The oil shock of 1973, when OPEC embargoed states supporting Israel, exposed Western dependence on Middle Eastern energy, and the 1979 Iranian Revolution replaced the Shah with an Islamic Republic under Ayatollah Khomeini, soon engulfed in the Iran–Iraq War (1980–1988).