Microsoft said sales of Xbox games and Office software helped push revenue up in the last quarter of 2011. IBM credited better sales of software and services and raised its earnings outlook for the year. Microsoft rose 6 percent and IBM rose 4 percent.
The Dow rose 96.50 points to close at 12,720.48. That's a gain of 0.8 percent. Without the huge gains in IBM and Microsoft, the Dow would have risen just 24 points.
The S&P 500 index inched up 0.88 to 1,315.38. Both the Dow and S&P ended the week with gains of more than 2 percent.
Plenty of things are going right, said Frank Fantozzi, CEO of Planned Financial Services, an independent wealth manager in Cleveland. Applications for unemployment benefits dropped last week to the lowest level in nearly four years. Housing sales are steadily rising. And most companies are reporting better profits.
"Overall, we're moving in the right direction and it's bolstered the market," Fantozzi said. "The S&P getting over 1,300 this week is a nice sign."
Google lost 8.4 percent after its earnings per share fell a dollar short of analysts' estimates. The misfire stemmed from an 8 percent drop in prices that the Internet search giant charges advertisers for each click.
Google's drop tugged the Nasdaq composite index lower. It fell 1.63 points to 2,786.70.
Even though high-profile companies such as Google and JPMorgan Chase have posted disappointing earnings results in the past week, the trend is moving in the opposite direction. Of the 60 companies in the S&P index that have reported earnings so far, 62 percent have beaten estimates, according to John Butters, senior earnings analyst at FactSet Research.
In another sign that traders were becoming more willing to take on risk, the yield on the 10-year Treasury note crossed above 2 percent for the first time in two weeks. The yield, a widely used benchmark for corporate and consumer borrowing, had inched lower since early December as traders parked money in the safest of assets.
The National Association of Realtors said that home sales rose 5 percent in December, the third straight monthly increase.
Among other companies in the news:
— Capital One Financial lost 5.6 percent. The bank and credit-card company's earnings sank 41 percent as expenses for marketing, salaries and legal fees jumped compared with the year before.
— Schlumberger rose 1.3 percent. The oil-field services company's quarterly profit surged 36 percent, helped by exploration work in the Middle East and Africa. The company also raised its quarterly dividend to 27.5 cents.
- Intel rose 2.9 percent. The world's largest chip maker reported stronger profits after the market closed Thursday. Intel's results got a boost from sales to China and other developing countries, where many people are buying PCs for the first time.
Stocks have been on a slow and steady climb to start 2012. The S&P 500 has closed higher on 11 of 13 days and is now up 4.6 percent for the year.