Khrushchev agrees to the terms of the first letter, and withdraws the missiles from Cuba. In return, the USA will not invade Cuba, and will remove it's missiles from Turkey.
In October of 1962, U2 aerial surveillance photos show the placement of several Soviet nuclear missiles in Cuba, all of which could reach and destroy the eastern and southern USA. President John Kennedy (Bruce Greenwood) and his team of advisers, led by Kenny O'Donnell (Kevin Costner) and Robert Kennedy (Steven Culp) try to come up with a plan to prevent the missiles from becoming operational. The Joint Chiefs want to invade Cuba and take out the missiles, but Kennedy knows that plan of attack will ultimately lead to nuclear war with the Soviet Union.
The President decides to form a blockade of Cuba to prevent any more missiles from reaching the island nation. The US Navy will board and inspect any vessels attempting to reach Cuba, and will turn away any with weapons on board. The plan works, as several Soviet ships turn around and return home. Kennedy also wants to continue the aerial surveillance of Cuba. O'Donnell proceeds to call the pilots and tells them that they are not to report any shots fired in their direction, for doing so would force the USA to retaliate under the rules of engagement, something Kennedy wants to avoid at all cost.
While this is happening, back-channel communications between the USA and USSR results in a hand-written letter from Premier Nikita Khrushchev to be delivered to the White House. In it, the Soviets promise to the remove the missiles from Cuba if the USA agrees to never invade the island. The next day, a second letter arrives, which gives the same promises, but includes the provision that the Americans remove their missiles from Turkey. Kennedy and his advisers determine that the hard-liners of the Soviet Politburo wrote the second letter, so they take the risky act of ignoring the second letter and agree to the terms of the first letter.
Due to a series of unfortunate accidents, including the shooting down of a U2 spy plane over Cuba, it's looking like war between the USA and USSR is inevitable. While Kennedy is ordering his Joint Chiefs to prepare for an invasion of Cuba, he also sends Robert to meet with Soviet Ambassador Anatoly Dobrynin in a last gasp effort of diplomacy. Robert reiterates the demand that the Soviets remove their missiles from Cuba, and in return the Americans won't invade Cuba. Dobrynin insists that the USA remove their missiles from Turkey, and Robert tells him that they will in six months. He also tells the ambassador that Khrushchev must give his answer to their demands by tomorrow, or war will commence.
The next day, Khrushchev announces the immediate dismantling and withdrawal of all Soviet missiles from Cuba, thus avoiding nuclear war. The movie ends with President Kennedy dictating a letter to the parents of the U2 pilot that was shot down and killed, and then a voice over by the real President John Kennedy giving a speech about the need for world peace.