The Intel logo is displayed at the entrance of Intel Corp. headquarters in Santa Clara, Calif. (Paul Sakuma/AP)

Major U.S. technology companies provided a surprisingly upbeat assessment of future business conditions Wednesday, helping to propel the stock markets to their highest levels in nearly three years.

The stellar reports from Intel, IBM and a handful of other tech giants provided a burst of optimism about the economic recovery. These firms provide computers, servers and cutting-edge equipment to countless companies that generally make such investments only when they feel ready to expand.

The technology companies not only reported strong profits over the past three months but also raised their expectations for the future. While some have been reporting good earnings for months, these companies said they are now seeing a wide array of businesses overcome their reluctance to open their wallets and replace equipment that aged during the recession.

“With the downturn in late 2008 and 2009, a lot of these companies hunkered down and put a Band-Aid on all their infrastructure and said, ‘We’re going to save money,’ ” said Kevin Sellers, Intel’s vice president of investor relations. “Now, things are looking better and they’re spending.”

Apple, meanwhile, which reported record profits after the market closed, said consumers continue to snap up its products as fast as it can make them.

The recovery still faces head winds. Unemployment remains high. Turmoil in the Arab world could disrupt oil supplies. Some economists are actually lowering projections for the year, concerned prices at the pump, which are close to $4 a gallon nationally, could dampen consumer spending, the most important element of economic growth.

But the news from the tech sector was relief for investors and carried the rest of the markets higher. The Dow Jones industrial average rose 1.5 percent to 12,453.54, a level not seen since June 2008. The tech-heavy Nasdaq jumped more than 2 percent.

Silicon Valley has plenty of reasons to feel good about the future. With new, transformative devices such as tablets rapidly catching on with consumers, businesses investing in cloud computing, and proposals to bring high-speed Internet to the farthest reaches of the country, technology spending appears poised to accelerate.

The sector’s significance was reinforced by President Obama’s visit Wednesday to the headquarters of Silicon Valley darling Facebook, where he discussed his strategies for reducing the national deficit (on top of wooing Bay Area campaign donors for the 2012 election).

“This is a bright spot in a gloomy economy,” said Michael Yoshikami, the founder and chief executive of YCMNet Advisors in Walnut Creek, Calif. “We’re at a revolutionary point of change where how people do business is going to change. We’re going to see more wireless and more cloud computing, which is going to require companies to spend money.”

This week’s best performances came from Intel, IBM, Apple and Juniper Networks — the world’s biggest chipmaker, a leading technology consultant, a consumer electronics giant and a major manufacturer of Internet networking equipment — proving that the technology sector’s strength is broad-based.

A downside is that many businesses that end up paying for this technology often have fewer needs to hire people. One company called Nuance makes a voice recognition software used by airlines and medical facilities, Yoshikami said.

“We might not like that, but it means they don’t have to hire someone with benefits who asks if your flight is international or domestic,” he said. “It’s happening with doctors — for the longest time, they were transcribing their own notes, but now Nuance sells dictation software for doctors.”

IBM and Intel both benefited from businesses overhauling their computer systems and from selling expensive equipment and services to emerging markets in Asia, Africa and Eastern Europe. The trend toward cloud computing and mobile devices plays to these companies’ strengths.

Intel shares jumped nearly 8 percent after the company predicted computer sales would be far better than it had anticipated. IBM’s stock fell about 0.4 percent, even though it raised its earnings outlook for the full year.

Rodney Adkins, an IBM senior vice president, said in an interview that the company’s offerings of data storage, encryption for online financial transactions, and analytics are helping firms save money that they can use to expand their businesses.

“A number of our clients are seeing real economic benefits for better managing their environments, and if they can scale in a way to manage that growth, that equates to economic savings,” he said.

Apple reported nearly $6 billion in profits in the fiscal second quarter, double the profits from the same period last year, thanks largely to its iPhone, which became available with Verizon Wireless. It sold nearly 19 million sets over the quarter — the equivalent of more than 200,000 a day.

Apple sold 4.69 million iPads, which is far fewer than the 6 million to 7 million tablets analysts predicted. The company said that the lower sales were due to supply issues but that it sold every product it made.

“We’re firing on all cylinders,” Steve Jobs, Apple’s chief executive, said in a statement. “We will continue to innovate on all fronts throughout the remainder of the year.”