Cheney was unhurt in the attack, which was claimed by the Taliban and was the closest that militants have come to a top U.S. official visiting Afghanistan. At least one U.S. soldier, an American contractor and a South Korean soldier were among the dead, NATO said.
Cheney said the attackers were trying "to find ways to question the authority of the central government." The Taliban said Cheney was the target.
About two hours after the blast, Cheney left on a military flight for Kabul to meet with President Hamid Karzai and other officials, then left Afghanistan.
The vice president had spent the night at the sprawling Bagram Air Base, ate breakfast with the troops and met with Maj. Gen. David Rodriguez, the commander of U.S. troops in Afghanistan.
He was preparing to leave for a meeting with Karzai when the suicide bomber struck about 10 a.m., sending up a plume of smoke visible by reporters accompanying him. U.S. military officials declared a "red alert" at the base.
"I heard a loud boom," Cheney told reporters. "The Secret Service came in and told me there had been an attack on the main gate."
He said he was moved "for a brief period of time" to a bomb shelter on the base near his quarters. "As the situation settled down and they had a better sense of what was going on, I went back to my room," Cheney added.
Asked if the Taliban were trying to send a message with the attack, Cheney said: "I think they clearly try to find ways to question the authority of the central government."
"Striking at Bagram with a suicide bomber, I suppose, is one way to do that," he said. "But it shouldn't affect our behavior at all."
Maj. William Mitchell said it did not appear the explosion was intended as a threat to Cheney. "He wasn't near the site of the explosion," Mitchell said. "He was safely within the base at the time of the explosion."
CBS News correspondent Sheila MacVicar reports large numbers of Afghan civilians frequently gather at the gates to Bagram in the morning, hoping to get work for the day.
There were conflicting reports on the death toll. Karzai's office said 23 people were killed, including 20 Afghan workers at the base. Another 20 people were injured, it said.
NATO's International Security Assistance Force said initial reports were that three people were killed, including a U.S. soldier, an American contractor and a South Korean soldier. U.S. officials indicated they planned to update that death toll.
Associated Press reporters at the scene saw 12 bodies being carried in black body bags and wooden coffins from the base entrance into a market area where hundreds of Afghans had gathered to mourn.
Friends and relatives cried and moaned as they took the bodies away from the base. Two men came to the base entrance crying and wringing their hands, one of them screaming, "My brother!"
A message posted on a Web site used by militants said "a mujahid ... carried out a suicide attack in front of the second gate of the Bagram Air Base. ... The target was Bush's vice president, Dick Cheney."
A purported Taliban spokesman, Qari Yousef Ahmadi, said Cheney was the target of the attack, which Ahmadi said was carried out by an Afghan called Mullah Abdul Rahim, of Logar province.
"We knew that Dick Cheney would be staying inside the base," Ahmadi told AP by telephone from an undisclosed location. "The attacker was trying to reach Cheney."
Mitchell noted that Cheney's overnight stay occurred only after a meeting with Karzai on Monday was canceled because of bad weather.
"I think it's a far-fetched allegation," he said, referring to the Taliban claim. "The vice president wasn't even supposed to be here overnight, so this would have been a surprise to everybody."