In the third quarter of 2018, Cenovus recorded cash from operating activities of nearly $1.3 billion compared with $592 million in the same period a year earlier. The company generated adjusted funds flow of nearly $1 billion, in line with the third quarter of 2017. Adjusted funds flow in the quarter reflected realized risk management losses of $325 million, largely related to Cenovus's remaining hedging activity, which was significantly reduced at the end of the second quarter. Cenovus had free funds flow of $706 million in the third quarter of 2018, a 30% increase year over year. Benchmark WTI prices increased almost 45% from the third quarter of 2017, while WCS prices increased 23%. The WTI-WCS price differential widened to an average of US$22.25/bbl in the quarter compared with US$9.94/bbl a year earlier. While the wider differential impacted cash generation from Cenovus's upstream operations, the lower cost of WCS relative to WTI provided a feedstock cost advantage for the company's refineries as did the wider price differential between WTI and West Texas Sour (WTS). Refining and Marketing operating margin was very strong in the third quarter, more than doubling to $436 million compared with the same period in 2017.
During the quarter, the company sold the Cenovus Pipestone Partnership in the Deep Basin for cash proceeds of $625 million before closing adjustments. The company realized a non-cash before-tax loss of $795 million on the sale. Including the proceeds of the sale and cash from operations, the company reduced net debt to below $8.0 billion at the end of the third quarter, down from $9.6 billion in the second quarter and $11.5 billion in the third quarter of 2017. On October 29, 2018, the company used cash on hand to redeem US$800 million of its US$1.3 billion unsecured notes due October 2019. The early redemption is expected to result in net interest savings of US$23 million. Reducing debt through free funds flow and asset sales remains Cenovus's top priority. The company continues to target a net debt to adjusted earnings before interest, taxes, depreciation and amortization (EBITDA) ratio of less than two times.
"We continue to make excellent progress on the commitments we've made to shareholders," said Alex Pourbaix, Cenovus President & Chief Executive Officer. "In the third quarter, we further reduced our net debt and took a significant step forward in streamlining our Deep Basin business while advancing our market access objectives through strategic rail commitments. We also continued to lower our cost structure, which has substantially improved over the past three years."
Citing Cenovus's improving leverage, reduced oil sands cost structure, substantial oil sands production and ability to generate strong annual free cash flow from its assets, Moody's Investors Service recently upgraded the company's corporate credit rating to Ba1 from Ba2. Moody's left the company's outlook unchanged at stable. Cenovus continues to maintain three investment grade credit ratings with other rating agencies.
Cenovus also made significant progress during the quarter in reducing its long-term fixed real estate costs by subleasing an additional eight floors of The Bow. With a portion of its excess real estate space now under sublease and plans to move staff into Brookfield Place being finalized, Cenovus has reassessed the value of its overall real estate portfolio at current market conditions and has recorded a non-cash expense of $630 million.
Cenovus expects the wide differentials Western Canadian oil producers have been experiencing will begin to ease in the coming months with major North American refineries returning to normal operations following scheduled maintenance, the planned ramp-up of Canadian oil-by-rail activity and the anticipated start-up next year of Enbridge's Line 3 Replacement project. The company has been positioning itself to generate significant free funds flow as market conditions improve and price differentials return to more historic levels.
In the third quarter of 2018, Cenovus executed three-year deals with major rail companies to transport up to 100,000 bbls/d of heavy crude oil from northern Alberta to various destinations on the U.S. Gulf Coast, where the company has been receiving robust pricing for its oil shipments. The rail agreements involve moving oil with CN from Cenovus's Bruderheim Energy Terminal, which has already started, and with CP through USD Partners' terminal in Hardisty, Alberta beginning in the second quarter of next year. Over the past few months, Cenovus has added resources at Bruderheim and increased shipments from the terminal and expects to continue ramping up its rail loading operations and railcar capacity through the end of 2019.
In addition to its rail agreements, Cenovus has firm capacity to the West Coast of 11,500 bbls/d on the existing Trans Mountain pipeline and 75,000 bbls/d of capacity to the U.S. Gulf Coast on the Flanagan South system. The company also has committed capacity on the proposed Keystone XL pipeline project and the Trans Mountain Expansion Project of 175,000 bbls/d combined, and Cenovus will consider adding committed capacity on future pipeline projects over time.
"With our rail contracts, pipeline commitments and existing refining capacity, our long-term market access position is strong," said Pourbaix. "In the short term, as takeaway capacity out of Alberta remains constrained, Canadian producers will continue to be disproportionately exposed to WCS pricing. To further mitigate the impact of wider differentials and improve long-term shareholder value, we're taking action on a number of fronts to optimize the margin on every barrel of oil we produce."
Through its 50% ownership in the Wood River and Borger refineries, the company gains a feedstock cost advantage when WCS prices are relatively low compared with WTI. This reduces Cenovus's exposure to crude oil price differentials. In the near-term, including its refining capacity, existing pipeline commitments and plans to ramp-up crude-by-rail loading capacity to 100,000 bbls/d, approximately 55% to 60% of Cenovus's blended heavy oil volumes can be partially mitigated against wider differentials.
Cenovus also has the ability to respond to widening differentials and the current environment for Canadian producers by strategically slowing production at Foster Creek and Christina Lake. The company is currently operating both facilities at reduced volumes and is managing production levels to avoid any impacts to its reservoirs. Cenovus will continue to monitor the Canadian price environment and adjust its oil sands production accordingly. The company expects oil sands production for the full year to be within guidance between 364,000 bbls/d and 382,000 bbls/d. In addition, Cenovus is actively assessing other avenues of production management to increase shareholder value, including exploring a variety of additional low-cost storage options for its oil.