Tesla finally hit Elon Musk’s production goal for the Model 3.

The company said in a regulatory filing Monday that it produced 5,031 Model 3s in the last week of the second quarter.

Tesla also raised its production target for the Model 3, its first mass-produced electric car. The company said it expects to make 6,000 per week by late next month.

The Model 3 had missed two ambitious production targets, but Musk had promised investors that the company would make 5,000 Model 3s per week by about this time of year.

“The last 12 months were some of the most difficult in Tesla’s history, and we are incredibly proud of the whole Tesla team,” the company said in the filing. “It was not easy, but it was definitely worth it.”

The filing comes after Musk tweeted late Sunday that Tesla’s team produced 7,000 cars in seven days. Tesla produced 1,913 Model S and Model X vehicles, it said in the filing.

Musk wrote to Tesla staffers that Tesla had achieved its goals. “I think we just became a real car company….” he reportedly said in the memo.

Tesla did not immediately respond to a request for comment.

Musk’s promise was a major test for the company, and investors were anxiously watching the production outcome. Tesla’s stock rose 5% early Monday.

Tesla confirmed it expects to turn a profit in the third and fourth quarters. It has only reported two profitable quarters in eight years as a public company and is deep in debt. The company is facing questions about its balance sheet, and Musk has lashed out against critics in recent months.

Musk continued to insist that he would hit the target of 5,000 Model 3s a week, and that it would give the company enough sales and profit to make it unnecessary to raise more cash.