2016 wasn't a great year for Boeing (BA -2.87%). The company had to take special charges in several different lines of business. Moreover, sinking demand for the Boeing 777 forced Boeing to renege on a commitment to keep that production line rolling at a rate of seven aircraft per month through the transition to the next-generation 777X.

Nevertheless, Boeing ended the year on a high note. On Wednesday morning, the company reported strong Q4 earnings results and offered a relatively favorable outlook for 2017.

Q4 by the numbers

Boeing's revenue declined modestly on a year-over-year basis last quarter, due to lower activity in its defense and space segment. Still, earnings per share grew relative to Q4 2015.

 Metric

Q4 2016

Q4 2015

Growth (YOY)

Revenue

$23.3 billion

$23.6 billion

(1.2%)

Commercial airplanes deliveries

185

182

1.6%

Core operating margin

8.9%

5.3%

N/A

Free cash flow

$2.2 billion

$2.5 billion

(10.5%)

Core EPS (adjusted)

$2.47

$2.44

1.2%

Total order backlog

$473 billion

$489 billion

(3.3%)

Data source: Boeing Q4 earnings releases.

In fact, EPS would have been roughly $0.30-$0.35 higher but for a $312 million charge related to the KC-46 Pegasus military tanker. The KC-46 has been a frequent source of special charges for Boeing in recent years, so it's not sensible to exclude this charge as a one-time occurrence. Even so, Boeing remains on track to deliver the first one to the U.S. Air Force later this year, after which the various earnings charges may come to an end.

One aspect of Boeing's Q4 performance that may look subpar is its free cash flow, which declined 10.5% year over year. However, this was driven by the timing of receipts versus expenditures. Thanks to strong cash performance during the first three quarters of 2016, Boeing's full-year free cash flow surged by 14.1%, or nearly $1 billion.

Boeing 787 profitability continues to rise

To meet its cash flow goals in the coming years, it's critical that Boeing continue to improve the profitability of 787 Dreamliner production. Boeing incurred tens of billions of dollars of losses building the first several hundred Dreamliners. However, production turned profitable last year, which is driving declines in the 787 deferred production balance (essentially, a cumulative tally of 787 production losses).

Last quarter, deferred production declined by $215 million sequentially. That's an improvement from a $150 million decline during Q3 and a $141 million increase in Q4 2015. This means that over the past year the Dreamliner program's cash profitability has improved by more than $1.4 billion on an annualized basis.

787 production is steadily becoming more profitable for Boeing. Image source: The Motley Fool.

The deferred production balance nonetheless remains massive, at $27.3 billion. To recoup those losses, Boeing will need to drive its cash profit margin for 787 deliveries much higher in the next few years.

2017 guidance is fairly good

Looking ahead to 2017, Boeing expects revenue to fall by about $3 billion. Most of the decline will come in the commercial airplanes segment. Boeing actually expects to deliver more aircraft this year, but this will be more than offset by a mix shift away from the large and pricey 777 and 747 families toward the smaller and cheaper 737. Military aircraft sales are also expected to decline by about $1 billion year over year.

On the other hand, Boeing expects core earnings per share to reach $9.10-$9.30 in 2017, representing solid growth (excluding Boeing's various earnings charges of the past year). This indicates that the company's cost cuts are more than offsetting the weak demand environment -- at least for now.

Most importantly, Boeing projects that free cash flow will rise by about $550 million year over year in 2017. That will allow the company to continue rewarding investors with high dividends and share buybacks in the coming year.