As was widely predicted, they have a deal: In separate announcements, Ford (NYSE: F) executives and leaders of the United Auto Workers confirmed on Tuesday that they had reached an agreement on a new four-year labor contract, subject to approval by workers.

It's a rich deal that should please (or at least placate) workers who have so far felt left out of Ford's recent prosperity. It certainly pleased Wall Street, as Ford's stock closed up over 7%. And it should please shareholders, too, because it appears to give Ford the one thing it needed most.

Many concerns for workers, one big concern for Ford
Ford's workers, as expected, did even better than their General Motors (NYSE: GM) counterparts. The new deal gives them a $6,000 signing bonus on ratification ($1,000 more than GM), $6,000 in "inflation protection" bonuses (a substitute for cost-of-living wage increases that's twice what GM workers will see), and a revamped profit-sharing program that would have paid $3,700 based on the North American profits reported by Ford so far this year (compare to $3,500 at GM).

The contract also promises a whole lot of new U.S. jobs -- some 12,000 of them, along with $6.3 billion worth of upgrades and tooling for Ford's U.S. factories to produce future models. That's the payoff from the promise that Ford CEO Alan Mulally has repeatedly made to UAW leaders of the last few years: Give us a business case to continue building cars in the U.S., and we'll commit to doing it.

See, despite the handsome-looking payouts included in the new contract, the big item is the one that the contract doesn't include: A wage increase for veteran autoworkers. New workers are paid at a significantly lower rate than veterans -- that was a landmark provision of the last contract -- but the more senior workers haven't had a wage increase in years. Many workers were hoping for a raise, and that may make the UAW leadership's job of selling the contract to its membership a bit complicated – but significant increases to Ford's fixed costs weren't on the table this time around.

The key to Detroit's renaissance
What Ford needed, plain and simple, is what GM got: To keep the company's breakeven point, particularly in the all-important North American market, as low as possible. Years of restructuring and meticulous efforts to create high-margin "gotta-have" products have put Ford in the once-unthinkable position (for a Detroit automaker) of being able to make money even when the economy's lousy.

Ford's been generating solid profits quarter after quarter even though the level of auto sales in the U.S. remains far below pre-2008 historical norms. Preserving that was essential to maintaining the trajectory of Ford's turnaround. While Ford executives, following both common sense and Detroit custom, won't comment on the details of the agreement until it's approved by the UAW rank and file, Vice President for Labor Affairs John Fleming did say on Tuesday that Ford's labor costs would stay roughly the same under the new agreement.

At about $58 an hour including wages and benefits, those costs aren't low -- in fact, they're among the highest in the industry. But they're low enough that Ford, leveraging its global economies of scale, has been able to produce products that compete well with the likes of Toyota (NYSE: TM), Honda (NYSE: HMC), and Hyundai (OTC: HYMTF).

A few things to watch
While the bonuses are generous, the contract also contains some provisions that should bring costs down a bit further over time. For instance, there are generous buyout offers for highly paid veteran workers (who would be replaced by new workers paid on a significantly lower wage scale). These will continue to help Ford keep production costs down over time.

That may be part of why Ford was willing to add so many jobs. The contract moves to the U.S. quite a bit of work that was originally planned for lower-cost non-U.S. factories and suppliers. But the new workers hired under the agreement will be paid the "Entry-Level" wage -- between $16 and $19 an hour, significantly below the $28 paid to those who were hired before 2007.

So will the workers approve it? We'll know more in a few days, though there's reason for concern -- as I've pointed out in the past, Ford's workers feel that they've been left out of the fruits of Ford's recovery. The UAW actually filed an "equality of sacrifice" grievance against Ford after the company paid bonuses to executives and nonunion white-collar workers. That grievance wasn't resolved by the contract -- it'll be heard by an arbitrator in November -- and it could continue to be a sore point as workers decide how to vote.

But from an outsider's perspective, given the new realities of Detroit, the UAW did pretty well here, and I'm hopeful that the contract will pass. And from a shareholder's perspective, Ford got exactly the deal it needed -- assuming, of course, that it passes.

Worried about the effect of higher energy prices? You're not alone. Here's the good news: It's not too late to profit. In the new special report," 3 Stocks for $100 Oil ," expert Motley Fool analysts name three outstanding companies that should benefit handsomely from rising oil prices. The report is available free of charge for Fool readers -- and here's your chance to get instant access.