A group of around 20 "mercenaries" led by an army officer who had deserted battled troops in the base for three hours, ending with two of the attackers being killed and eight captured, President Nicolas Maduro said on state television.
The other 10 escaped with an arsenal taken from the base, according to officials who said an "intense search" was underway.
Maduro claimed the group had ties to Colombia and the United States.
The incident heightened fears that Venezuela's deepening political and economic crisis could explode into greater violence.
Officials insisted afterward that all was normal across the country.
Military helicopters flew overhead and tactical armored vehicles patrolled the streets in Valencia, a major northwestern city, in a climate of tension after the attack.
Locals said a nighttime curfew had been imposed. Police dispersed protesters who set up flaming barricades across roads.
The armed forces said in a statement "a group of civilian criminals wearing military uniforms and a first lieutenant who had deserted" carried out the attack.
Maduro said the lieutenant, among those captured, was "actively giving information and we have testimony from seven of the civilians."
Loyal military chiefs
Maduro congratulated the army for its "immediate reaction" in putting down the attack, saying they earned his "admiration."
Venezuela's opposition has repeatedly urged the military to abandon Maduro.
But Defense Minister Vladimir Padrino, the head of the armed forces, has said the military's loyalty was unshakable.
Related reading
Venezuela's military: Key things to know
After Sunday's attack in Valencia, Padrino tweeted that the assailants "couldn't do anything against" the army.
In a video posted online just before the attack, a man presenting himself as an army captain named Juan Caguaripano declared a "legitimate rebellion... to reject the murderous tyranny of Nicolas Maduro."
Speaking with 15 men in camouflage standing by him, some of them armed, he demanded a transitional government and "free elections."
It was not known if he was the lieutenant referred to in the military statement.
That statement said the officer had deserted three years ago and taken refuge in Miami, in the US state of Florida.
Venezuela isolated
Venezuela has become increasingly isolated internationally as Maduro tightens his hold on power through a contested loyalist assembly that started work this week.
The opposition, which controls the legislature, has been sidelined. Its leaders are under threat of arrest after organizing protests, fiercely countered by security forces, that have left 125 people dead in the past four months.
One prominent leader, Leopoldo Lopez, was returned to house arrest after being hauled off to military prison four days ago.
The new Constituent Assembly, packed with Maduro allies including the president's wife and son, has quickly used its supreme powers to clamp down on dissent.
On Saturday, it ordered the dismissal of the attorney general, Luisa Ortega, who had broken ranks with Maduro to become one of his most vociferous critics.
RELATED READING
Venezuelan oppn leader home from jail
On Sunday it announced - then suspended - the creation of a "truth commission" sought by Maduro to probe alleged crimes by the opposition.
The United States accuses Maduro of installing an "authoritarian dictatorship" that has turned Venezuela into an international pariah.
The United States, Brazil, Colombia, Chile, Guatemala, Mexico, Panama and Peru have slammed the "illegal" sacking of Ortega.
And Argentina, Uruguay, Paraguay and Brazil have indefinitely suspended Venezuela from the South American trading bloc Mercosur for its "rupture of the democratic order."
"Each step by the Constituent Assembly is a step towards the precipice by this government," the leader of the opposition parliament, Julio Borges, told a news conference in Caracas on Sunday.
"The only thing it has left is brute force... The only thing it wants is to cling to power," he said, calling for more protests.