Lai was released in the early hours of Wednesday, flanked by his lawyers, and greeted by supporters who chanted "fight till the end" and "support apple, have an apple a day", referring to the pro-democracy tabloid.
He did not make any comment after his release. Lai’s bail was set at HK$300,000 ($38,461), plus a HK$200,000 ($25,805) surety.
The ardent critic of Communist Party rule in Beijing was arrested on Monday for suspected collusion with foreign forces when some 200 officers raided his newspaper's offices and collected 25 boxes. Journalists at the newspaper had streamed on Facebook dramatic footage of the raid.
In total, 10 people were arrested on Monday, with the targeting of pro-democracy opposition figures in the semi-autonomous territory drawing international criticism and raising fears that Beijing is revoking freedoms promised under the "one country, two systems" formula that has been in place since the end of British colonial rule in 1997.
The sweeping security legislation, imposed on June 30, punishes anything Beijing considers secession, subversion, "terrorism" or collusion with foreign forces with up to life in prison.
Hong Kong's Beijing-backed government and Chinese authorities say the law is necessary to restore order after months of at times violent anti-government and pro-democracy protests last year.
Lai's release comes after his two sons and activist Agnes Chow were also released late on Tuesday.
Upon her release, Chow, who became a prominent figure in the so-called Umbrella Movement of 2014, called her arrest "political persecution and political suppression", according to the South China Morning Post.
"It's very obvious that the regime is using the national security law to suppress political dissidents," she said.
Chow also told reporters that she was "unprepared" when she was arrested on Monday night.
"I have been arrested four times before, but honestly this time, I was scared the most. And it was the hardest."
She addedthat authorities did not present any evidence how she violated the national security law.
The most recent crackdown came less than two weeks after police made their first arrests of four students under the new national security law.
The Apple Daily has responded with defiance over the arrest of Lai, with readers queuing from the early hours of Tuesday to get copies of the newspaper.
"Apple Daily must fight on," its front-page headline read.
"The prayers and encouragement of many readers and writers make us believe that as long as there are readers, there will be writers, and that Apple Daily shall certainly fight on."
More than 500,000 copies were printed, compared with the usual 100,000, the paper said on its website.
Mainland-born Lai, who was smuggled into Hong Kong on a fishing boat when he was a penniless 12-year-old, is one of the most prominent democracy activists in the city.
The Chinese government has labelled him a "traitor" in the past and issued a statement supporting his arrest, while the Beijing-backed China Daily newspaper said Lai's arrest showed "the cost of dancing with the enemy".
The paper added that "justice delayed didn't mean the absence of justice".
The most recent arrests also sparked a fresh round of international condemnation
United States Secretary of State Mike Pompeo on Monday called Lai a "patriot", saying Beijing had "eviscerated" Hong Kong's freedoms.
Meanwhile, the United Kingdom said Lai's arrest was further evidence the security law was a "pretext to silence opposition", to which China's embassy replied by urging London to stop "using freedom of the press as an excuse to discredit" the law.
The US last week imposed sanctions on several top officials over what it said was their role in curtailing political freedoms in Hong Kong. China responded with sanctions on top US legislators and others.
One of the key problems today is that politics is such a disgrace, good people don't go into government.