Botha died at his home on the southern Cape coast at 8 p.m., according to the South African Press Association. "Botha died at home, peacefully," Capt. Frikkie Lucas was quoted as saying.
The African National Congress issued a statement expressing condolences and wishing his family "strength and comfort at this difficult time."
Nicknamed the "Old Crocodile" for his feared temper and sometimes ruthless manner, Botha served as head of the white racist government from 1978 to 1989.
Botha liked to depict himself as the first South African leader to pursue race reform, but he tenaciously defended the framework of apartheid, sharply restricting the activities of black political organizations and detaining more than 30,000 people.
Through a series of liberalizing moves, Botha sought support among the Asian and mixed-race communities by creating separate parliamentary chambers. He lifted restrictions on interracial sex and marriage. He met with Mandela during his last year as president.
But after each step forward, there was a backlash, resulting in the 1986 state of emergency declaration and the worst reprisals of more than four decades of apartheid.
Botha's intransigence on releasing Mandela led the anti-apartheid Johannesburg Daily, Business Day, to write: "The government is now the prisoner of its prisoner; it cannot escape his embrace."
Within a year after Botha stepped down, de Klerk released Mandela after 27 years in prison and put South Africa on the road to its first all-race elections in 1994, when Mandela became president.
In December 1997, Botha stubbornly resisted appearing before a panel investigating apartheid-era crimes. He risked criminal penalties by repeatedly defying subpoenas from the Truth and Reconciliation Commission to testify about the State Security Council that he headed.
The council was believed to have sanctioned the killing and torture of anti-apartheid activists, and the panel wanted to know what Botha's involvement was.
Born Jan. 12, 1916, the son of a farmer in the rural Orange Free State province, Botha never served in the military or graduated from college. He quit university in 1935 to become a National Party organizer.
During World War II, Botha joined the Ossewabrandwag (Ox Wagon Fire Guard), a group that was sympathetic to the Nazis and opposed South Africa's participation on the Allied side.
Botha won election to Parliament in 1948, the year the National Party came to power and began codifying apartheid legislation. He joined the Cabinet in 1961 and became defense minister in 1966.
As head of the white-minority government in 1978, Botha repeatedly stressed the paramount importance of national security. He charged that the anti-apartheid struggle was a "total onslaught" on South Africa instigated by communist forces.
During a series of gradual race reforms, he told white South Africans they must "adapt or die." A new constitution in 1983 gave Asians and mixed-race people a limited voice in government, but continued to exclude blacks.
The new law also drastically increased Botha's powers, changing his title from prime minister to president. He declared a national emergency in 1986 after widespread violence erupted in black areas, where anger focused on the new constitution.
State security forces brutally quelled the opposition, and one of his former lieutenants — police minister Adriaan Vlok — told the Truth Commission that Botha had personally congratulated Vlok for successfully bombing a building thought to harbor anti-apartheid activists and weapons.
But in documents submitted to the panel, Botha denied knowledge of the killings, torture and bombings.
Botha's reprisals against the black majority drew international economic sanctions against South Africa during the 1980s that contributed to apartheid's fall.
In July 1989, Mandela went from prison to Botha's official residence for a conversation, which increased speculation that Botha would free Mandela.
Mandela recalled going into the meeting thinking he was seeing "the very model of the old-fashioned, stiff-necked, stubborn Afrikaner who did not so much discuss matters with black leaders as dictate to them."
He found Botha holding out his hand and smiling broadly "and in fact, from that very first moment, he completely disarmed me," Mandela wrote in his autobiography.
Mandela said the only tense moment was when he asked Botha to release all political prisoners — including himself — unconditionally.
"Mr. Botha said that he was afraid he could not do that," Mandela wrote.
The meeting was one of Botha's last acts before he was ousted as National Party leader by de Klerk in September 1989.
Botha refused to attend a farewell banquet held in his honor by the party he had served for 54 years. After 1990, he quit the National Party.
Botha's foremost loyalties were to his fellow Afrikaners, yet his moves to extend limited political power to nonwhites prompted a mass defection of hard-line segregationists from the National Party in 1982.
Beeld, an Afrikaans-language daily that supported Botha for many years, said, "The last image that will linger ... is that of a blind Samson who with his last strength tried to overturn the pillars of his party on himself and his own companions."
There has been no decision on funeral arrangements.