commercial aerospace market will continue for the balance of the year. Finally, demand in the energy sector, which we define as mainly oil and natural gas improved slightly in the second quarter as a result of increasing oil prices and rig counts along with customer inventory replenishment. We expect demand in the energy sector to continue to improve at modest levels in the second half of the year.
In summary, the first half of 2021 was distinguished by back to back quarters of record financial performance. Today, early in the third quarter of 2021 positive momentum in both demand and pricing continue, which, when combined with our proven and resilient business model positions us to optimize our performance and deliver strong results once again. We thank our Reliance colleagues for their dedication to health, safety, and operational excellence. And we also sincerely thank our customers and suppliers for their ongoing support as we all manage through these extraordinary times. I will now turn the call over to Arthur, who will review our financial results. Thank you.
Thanks Karla, and good morning, everyone. I'll start with a recap of our quarterly results. Once again, record pricing levels, healthy demand, and strong gross profit margins contributed to record gross profit dollars, which in turn, drove record pretax income and record earnings per share. The significant increase in metal pricing and ongoing strengthened demand resulted in record quarterly sales of $3.42 billion, up 20.4% from the first quarter of 2021, and up 69.3% from the second quarter of 2020. Strong pricing momentum for most carbon and stainless steel products contributed to the 19.7% increase in our average selling price per ton over the first quarter of 2021. As Jim and Karla mentioned, the continued pricing discipline we focus on higher margin orders by our managers in the field, along with our ongoing investments in value added processing capabilities collectively resulted in record quarterly gross profit of $1.08 billion and a strong gross profit margin of 31.7% in the second quarter of 2021.
Our non-GAAP FIFO gross profit margin of 37.5% in the second quarter of 2021 was a record and exceeded the prior quarter by 40 basis points and the prior period by 730 basis points. Please refer to our earnings release where we provide a reconciliation of LIFO to non-GAAP FIFO gross profit margin for each reported period. We incurred LIFO expensive OF $200 million or $2.31 per share in the second quarter of 2021 compared to LIFO expense of $100 million, or $1.16 per share in the first quarter of 2021. As a result of higher than anticipated costs for certain carbon and stainless steel products, we revised our annual LIFO expense estimate to $600 million from $400 million for 2021. Consistent with our accounting policy, we allocate our annual estimate on a pro rata basis in each quarter and had to true up to our new annual estimate in the second quarter of 2021 by incurring $200 million of LIFO expense, bringing our six month 2021 LIFO expense to $300 million.
Our current projected LIFO expense for the third quarter of 2021 is $150 million based on this revised annual LIO expense estimate. As in prior years, we will update our expectations each quarter based upon our inventory costs and metal pricing trends. At the end of the second quarter of 2021, Our LIFO reserve on our balance sheet was $415.6 million and is projected to be $715.6 million at December 31, 2021 based on our current $600 million annual LIFO expense estimate. This reserve can benefit earnings in future periods that include declining metal prices.
Now turning to our expenses; our second quarter SG&A expense increased $44.8 million or 8.6% compared to the first quarter of 2021. The bulk of the quarter-over-quarter increase was a result of higher incentive based compensation, given our record gross profit and pretax income levels. Additionally, inflation contributed to increase variable expenses, most notably for fuel and freight as well as packaging costs. In comparison to the prior period SG&A expense was up $124.8 million or 28.5%, primarily as a result of higher incentive based compensation to variable plan and delivery expenses associated with 70.5% increase in shipments and to a lesser extent, inflationary increase.
Overall, our headcount was relatively flat, compared to both the first quarter of 2021 and the second quarter of 2020. Our non-GAAP pretax income of $442.8 million in the second quarter of 2021 was the highest in our company's history. Our non-GAAP pretax income margin of 13% was also a record. Our effective income tax rate for the second quarter of 2021 was 25.6%, up from 20.9% in the second quarter of 2020, mainly due to higher profitability. We currently anticipate a full year 2021 effective income tax rate of 25.5%. We generated record quarterly earnings per share of $5.08 in the second quarter of 2021, compared to $4.12 in the first quarter of 2021, and $1.24 in the second quarter of 2020.
Now turning to our balance sheet and cash flow; our operations continue to generate cash, despite significantly higher working capital needs attributable to rising metal costs. In the second quarter, we again generated strong cash flow from operations of $101.6 million despite over $300 million in additional working capital requirements. In addition, our second quarter of 2021 cash flow from operations was impacted by approximately $174 million of income tax payments, compared to $7 million in the first quarter of 2021. As of June 30, 2021, our total debt outstanding was $1.66 billion, resulting in a net debt to EBITDA multiple of 0.7x. We had no borrowings outstanding on our $1.5 billion revolving credit facility, providing us with ample liquidity to continue executing on all areas of our capital allocation strategy, while maintaining our investment grade credit ratings.
I'll now turn to our outlook. We remain optimistic about business conditions in the current environment, with strong underlying demand in the majority of the end markets we serve. However, we expect factors impacting shipment levels in the second quarter of 2021, such as metal supply constraints, labor shortages, and other supply chain disruptions will continue to persist in the third quarter of 2021. As such, we estimate tons sold be down 1% to up 1% in the third quarter of 2021 compared to the second quarter of 2021. We expect metal pricing trends to remain strong in the third quarter as metal prices at the beginning of the third quarter of 2021 are higher than the average for the second quarter of 2021. We estimate our average selling price per ton sold for the third quarter of 2021 will be up 7% to 9%. Based on these expectations, we currently anticipate non-GAAP earnings per diluted share in the range of $5.55 to $5.75 for the third quarter of 2021.
In closing, we're thrilled with our operational and financial performance in the second quarter, supported by strong pricing and demand trends, as well as outstanding execution by all of our colleagues in the field, who continue supporting our customers' needs. These factors, coupled with our resilient business model resulted in yet another quarter of record financial performance and solid cash flow, enabling us to continue executing on our capital allocation priorities of investing in the growth of our business and returning value to our stockholders. That concludes our prepared remarks. Thank you for your attention. And at this time, we'd like to open the call up to questions. Operator?
And our first question is from Sathish Kasinathan with Deutsche Bank.
SathishKasinathan
Yes. Hi, thank you. Good morning, Jim, Karla and Arthur. Thanks for taking my questions. You mentioned that shipments to non risk construction market are back to pre pandemic levels and that shipments to heavy industry are above pre pandemic levels. Can you also provide similar comparison on what the current shipment levels are for other end markets? Mainly automotive, tolling, commercial aerospace and energy. And when do you expect the volumes to recover to previous levels?
KarlaLewis
Hi, Satish. How are you today? I'll hit that. So we did point out a couple of end markets where we did see and when weren't comparing to pre pandemic in our comments here, we compare to the second quarter of 2021 to the second quarter of 2019. And so there were obviously different levels of strength in some of those end markets in the second quarter of 2019. But we called out those areas where our Q2, '21 shipment levels were higher, to the best that we can tell us, I think you're familiar, we don't have perfect end market visibility, but based on our best estimates, and the products that we sell into those end markets, non res construction and heavy equipment, along with our defense, military and space markets, we did call out we're above pre pandemic levels. That means that the other end markets we sell into are not yet above pre pandemic levels.
And as you know, you're aware and we call it out commercial aerospace certainly was hit the hardest of our end markets by the pandemic, still recovering, although we are seeing some improvement there. Same with the energy market. And we expect to see some continued improvement in both of those markets. I will say generally, all of our other end markets we feel are at good healthy levels, strong in some cases, we expect that that underlying demand to continue to be strong and to get back to pre pandemic levels in a lot of those other markets. Commercial aerospace lagging the others, but good, really good demands seen by our customers, especially with the way we service these markets, the customers that we sell to are seeing really strong demand.
Okay, thank you. That's helpful color. My next question is a clarification on CapEx. I think Arthur mentioned that the previous CapEx of $245 million, there was also some carryover cash