risk of delays arising after groundbreaking. Planning discussions with Panasonic and other potential production and supply chain partners continue to go well and we are pleased with the high interest level in the project. By the time the Gigafactory reaches full, annualized production in 2020, we expect battery pack production capacity to reach 50 GWh and cell production capacity to be 35 GWh. At that level of production, we do not anticipate any commodity supply constraints.
Q1 Results
As usual, this letter includes both GAAP and non-GAAP financial information because we plan and manage our business using this non-GAAP information. Non-GAAP financials exclude stock-based compensation and non- cash interest expense, and add back the deferred revenue and related costs for cars sold with a resale value guarantee (RVG). The option to obtain financing via our bank partners and get an RVG from Tesla remains popular with our U.S. customers. We delivered 1,181 cars with an RVG in Q1.
Non-GAAP revenue was $713 million for the quarter up
27% from a year ago, while GAAP revenue was $621
million. The average selling price of Model S remained
strong. Automotive revenue included $15 million of Toyota powertrain sales and almost $12 million of regulatory credit sales, but no zero emission vehicle (ZEV) credit sales as expected.
During Q1, we achieved a non-GAAP automotive gross margin of 25.4%, and 25.3% on a GAAP basis. This represents a 20 basis point improvement in non-GAAP automotive gross margin sequentially, despite booking an unplanned $2 million reserve for underbody shield retrofits.
Research and development (R&D) expenses were $68 million on a non-GAAP basis and $82 million on a GAAP basis. Non-GAAP R&D expense was up 17% from Q4, as Model X engineering work accelerated and efforts continued to adapt Model S for growing international markets.
Selling, general and administrative (SG&A) expenses were $97 million on a non-GAAP basis and $118 million on a GAAP basis. The 11% sequential increase in non-GAAP SG&A expense was driven mainly by the expansion of our customer support infrastructure.
Q1 non-GAAP net income was $17 million, or $0.12 per share based on 140.2 million diluted shares, while Q1 GAAP net loss was $50 million or $(0.40) per share. Both results include a $6.7 million net gain from a favorable foreign currency impact.
We generated $61 million of cash flow from operations during the quarter. This was after consuming $63 million from increased inventory of in-transit finished vehicles built to specific customer orders. Capital expenditures in the quarter totaled $141 million.
Cash at quarter end, including cash equivalents and short-term marketable securities, increased to almost $2.6 billion, in part because we issued $2 billion of senior convertible notes with five and seven year maturities. Q2 financials will reflect an additional cash inflow of $267 million from the exercise of the convertible notes overallotment option by our underwriters. We used a small portion of the gross proceeds to invest in bond hedge transactions, offset by proceeds from a sale of related warrants. As a result, we should avoid any actual dilution from the convertible notes until our common stock climbs over $500 per share. A table published on our website shows the potential dilution from our note offerings at various projected stock prices.