Juan Guaidó was travelling to a rally when intelligence agents intercepted his car north of the capital, Caracas.
The agents have been sacked over the “irregular procedure”, part of a “media show” to benefit the opposition, the information minister says.
President Nicolás Maduro was sworn in for a second six-year term on Thursday.
The opposition calls him illegitimate and Mr Guaidó said on Friday he was ready to assume the Venezuelan presidency on an interim basis.
— Antonio Ledezma (@alcaldeledezma) January 13, 2019
He was released about an hour later. The exact circumstances surrounding Sunday’s events are still unclear.
Information Minister Jorge Rodríguez said rogue agents of the intelligence agency, Sebin, had acted unilaterally.
Later, Mr Guaidó told supporters at a rally: “I want to send a message to Miraflores [the presidential palace] – the game has changed… Here we are! We are not afraid!”
He said Mr Rodríguez’s comments were a sign that the government had lost control of its own security forces.