(Dow Jones) The latest version of the Democrats' health overhaul costs $940 billion over a decade, yet it would bring down the federal budget deficit by $138 billion, according to the nonpartisan Congressional Budget Office.

How can the bill spend so much and still reduce the deficit? The answer lies mainly in new taxes and curbs on Medicare spending.

The CBO numbers reflect the combined cost of two pieces of legislation. First is the version of the health overhaul passed through the Senate on Christmas Eve. Second is a package of changes released Thursday.

The cost includes $466 billion to give tax credits to help lower earners buy insurance, $434 billion to expand the Medicaid federal-state insurance program for the poor and $40 billion in tax credits to help small businesses offer coverage.

The CBO said the Senate bill by itself would reduce the federal budget deficit, currently running at some $1.3 trillion a year, by $118 billion over a decade compared with current law. That's because the new taxes and spending cuts are greater than the cost of expanding insurance coverage. The changes added an additional $20 billion in deficit reduction.

The CBO also said the deficit would fall further in the second decade after the bill's enactment. It declined to give a dollar figure but estimated the amount would be equal to around one-half percent of gross domestic product. CBO described the second-decade predictions as imprecise.

In the change package, Democrats significantly peeled back a tax on high-value insurance plans, so it will now raise $32 billion over a decade, down from $148 billion under the Senate bill. They also spent more money to increase subsidies for lower- and middle-income people and cover a greater portion of their health costs.

A family of four making up to $88,000 a year would qualify for subsidies, with lower earners getting more help. And Democrats increased funding for seniors on Medicare whose prescription drugs fall in a coverage gap known as the doughnut hole, starting with a $250 drug rebate this year.

To offset those extra costs, the Democrats made deeper spending cuts and added new taxes. The bill already included taxes on health industries such as drug makers and insurance companies. The change package expands Medicare taxes. Families earning more than $250,000 a year will pay a 3.8% Medicare tax on unearned income such as dividends and interest. Currently such income doesn't face Medicare taxes. The latest package includes deeper cuts to privately administered Medicare plans under the Medicare Advantage program. They now total about $200 billion over a decade, just short of double their amount in the Senate bill.

It also contains a handful of other smaller revenue-raising provisions, including closing a tax loophole for pulp and paper companies.