A judge on Tuesday approved a settlement between the federal government and Tesla over claims that founder Elon Musk exaggerated when he claimed to have secured funding to take the electric carmaker private, prompting a run-up in the company's stock.

The agreement with the Securities and Exchange Commission will require Musk to relinquish his role as chairman of the Tesla board, and he and the company will have to pay separate $20 billion fines. Shortly after the deal was reached, the 47-year-old entrepreneur referred to the SEC on Twitter as the "Shortseller Enrichment Commission," a reference to Musk's long-standing criticism of investors betting against the company's stock.

The SEC filed its suit after Musk's August tweet that he had obtained backing to take Tesla private at a price of $420 per share, a substantial premium to the price of the company's stock at the time, and one that regulators said wasn't adequately supported by the facts. The number was chosen because of use as slang for smoking marijuana, the agency said.

Under the agreement, Tesla will be required to appoint two new independent directors to its board and put safeguards in place to monitor Musk's communication on online social platforms.

Tesla's stock rose 3.7 percent to $292.22 in New York trading.