TOKYO — Carlos Ghosn, the former automotive executive charged with financial wrongdoing, was released from a Tokyo jail on Thursday evening after posting a multimillion-dollar bond for the second time in two months.

A district court judge ruled earlier in the day that the former head of the Nissan-Renault-Mitsubishi alliance could leave the detention center, and Mr. Ghosn’s lawyer quickly paid a 500 million yen, or $4.68 million, bond.

The prosecutor’s office, which has repeatedly fought Mr. Ghosn’s release, attempted to appeal the ruling, but the judge refused its argument that Mr. Ghosn could tamper with evidence or witnesses if set free.

Mr. Ghosn, wearing a dark suit, walked out of the detention center shortly before 10:30 p.m., flanked by police officers, and got into a black van. He was accompanied by his lawyer, Takashi Takano.