As it ramps up production of the Tesla Model 3, Tesla announced Wednesday that it reduced its financial losses in the second quarter—barely.

The result is significant, because Tesla is racing against the clock to keep from running out of money before it can build enough of its new, more affordable Model 3s to turn a profit.

Tesla says it lost nearly $743 million between April and June this year, compared with about $785 million last quarter. That leaves the company with $2.2 billion cash compared with $3.3 billion at the end of 2017. Compared with the first six months of last year, the company's loss was up from about $800 million to more than $1.5 billion.

READ THIS: Tesla Model 3 production reaches 5,000 cars in last week of June

CEO Elon Musk has said that the company would become profitable by late this year as it ramps up production and deliveries of the Model 3.

"Our goal is to be profitable and cashflow positive in every quarter going forward," Musk said in the earnings call, allowing that there may be some quarters in which the company pays back debt, which could interrupt that trend.

For the company to become profitable, Musk has set new goals to produce 6,000 Model 3s per week by the end of August, and yet another lofty goal for next year to reach 10,000 Model 3s per week. 

First Tesla Model 3 AWD Performance produced

First Tesla Model 3 AWD Performance produced

In its last production call in early July, Tesla had barely made its goal of producing 5,000 of the cars a week by the end of June—and that for only a week and by the skin of the company's new tent that houses the car's second production line.

The report notes that the company repeated the accomplishment "several times" again in July.

Multiple independent reports have shown that the Model 3 is profitable for the company to build. The trick is to crank out enough of them to flood the balance sheet before the cash runs out.

DON'T MISS: Tesla Model 3 shows bigger profit in latest cost breakdown

The latest report is somewhat more optimistic on that front, showing a significant bounce in revenues from Model 3 production, up from $3.4 billion in the first quarter to just over $4 billion in the last quarter.

The report notes the company expects that revenue to boost its available cash through the end of the year.

Tesla acknowledged in the report that it has begun selling Model 3s to new customers who had not previously placed a reservation, indicating that those remaining on the waiting list may be holding out for the base, $35,000 Model 3, which will not do as much for Tesla's balance sheet as the $50,000 to $80,000 cars it has sold so far.

'Revenge of the Electric Car' premiere: Tesla Motors CEO Elon Musk on red carpet

'Revenge of the Electric Car' premiere: Tesla Motors CEO Elon Musk on red carpet

Tesla's improved revenues helped the bottom line, but were offset by expenditures for severance pay after the company laid off 9 percent of its workforce in June and by expenses incurred in building the new assembly line, among other things.

CHECK OUT: Tesla earnings, cash-burn up; Model 3 production, barely

In the company's previous earnings call, in which he initially announced the layoffs, Musk also said the company would reduce its capital expenditures—investments going forward. The balance sheet shows capital expenditures down about 7 percent compared with the previous quarter.

Musk is staring down a hurdle in the middle of the track as Tesla begins to build speed in producing the Model 3: In November, the first in a series of loans will start to come due, according to The Wall Street Journal (subscription required.)

The company will have to begin making payments on $230 million in debt in November unless its stock price jumps to more than $560 by then. After losing almost 20 percent of its value after the previous earnings call, Tesla stock bounced about 5 percent in after hours trading immediately after the latest earnings report was released.