Companies are using a dramatic surge in cash to invest both in the present and the future at levels not seen in at least a decade.

As things stand, 2018 will be the first time since 2007 that companies are spending a bigger portion of cash on share buybacks than capital expenditures. Goldman Sachs has estimated that share repurchases could total more than $1 trillion this year.

But what hasn't been quite as apparent has been the willingness to take spend on capital expenditures. In fact, Goldman estimates that if the current pace continues, 2018 will be the biggest year for capex in a quarter century, even though it is lagging buybacks.

"Rumors of the demise of capital spending have been greatly exaggerated," David Kostin, the bank's chief U.S. equity strategist, said in his most recent market note.

The investment numbers look like this: capital investment, which includes money spent to upgrade physical equipment such as buildings, equipment and machinery, jumped to $341 billion in the first half of the year, an increase of $55 billion, or 19 percent.

In addition, companies spent $147 billion on research and development in the first half, a 14 percent increase that represents the highest move in a decade.

The surge comes amid the massive windfall from a $1.5 trillion tax cut package that sliced the nominal corporate rate from 35 percent to 21 percent. Critics have argued that the move will be a budget buster and will mostly benefit investors due to the likelihood that companies will pour most of the money into share buybacks.

"In the last 25 years, you've never had capital spending growth at that level," Kostin told CNBC's "Squawk on the Street." "Both arguments are correct in terms what are companies doing with this incremental cash ... partly as the result of lower taxes."

The buybacks number for sure has surged this year as well.

Repurchases hit $384 during the first six months, a 48 percent jump from the same period in 2017. The third quarter has seen no letup, with the total year-to-date buyback level now at $762 billion through mid-September, putting the trend easily on pace to top the $1 trillion Goldman estimate.

However, capital spending is more broad-based.

The 10 largest capex boosters comprised 53 percent of the total increase for S&P 500 companies, according to Kostin. By contrast, the 10 largest buyback companies totaled 78 percent of the total growth for the index.

Apple has been by far the leader in buybacks, with its $45 billion accounting for 24 percent of the total growth.

For investors, following the big buyback companies has been a more profitable trade this year. Companies focused on R&D and capex have underperformed the S&P 500 by four percentage points, while buyback-focused stocks have equaled the index.