A big earnings miss from Caterpillar on Friday wasn’t enough to derail a rally that pushed the stock market up 2 percent for the week.

Caterpillar Inc. fell nearly 6 percent after the heavy-equipment maker earned less than analysts were expecting last quarter, partly because of the earthquake and tsunami disaster in Japan. The company is seen as a bellwether for the global economy because it sells construction and mining machinery all over the world.

The results from Caterpillar and a continuing deadlock over raising the U.S. borrowing limit capped the stock market’s gains. Overseas markets rose after European leaders reached a deal late Thursday aimed at containing the region’s debt crisis.

The Dow Jones industrial average fell 43.25 points, or 0.3 percent, to 12,681.16. Even with the decline, the Dow gained 1.6 percent for the week. It has finished three out of the past four weeks higher than where it started.

The Standard & Poor’s 500 index gained 1.22, or 0.1 percent, to 1,345.02. It finished the week with a gain of 2.2 percent.

Energy, technology and con- sumer discretionary companies were the only three of the 10 industries tracked by the S&P 500 that rose. That was still enough to push the broad market index higher.

Consumer discretionary companies include retailers like Amazon Inc. and restaurant chains like McDonald’s Corp. McDonald’s rose 2 percent, the most of any stock in the Dow average, after its income and revenue came in higher than analysts were expecting due to strong sales in Europe.

Technology stocks rose broadly after Advanced Micro Devices Inc. reported strong second-quarter earnings and said its new computer graphics chip was selling well. The Nasdaq composite index rose 24.40 points, or 0.9 percent, to 2,858.83.

AMD jumped 19 percent. Flash memory card maker SanDisk Corp. rose 10 percent after its earnings rose sharply. Microsoft Corp. gained 1.6 percent after beating analysts’ income estimates.

Traders kept close watch on negotiations in Washington over a deal to raise the nation’s debt ceiling ahead of an Aug. 2 deadline. The impasse has overshadowed an agreement in Europe to give Greece a second financial lifeline and broaden the powers of a regional bailout fund.

Strong earnings from Apple Inc., Coca-Cola Co. and IBM Corp. helped send stocks higher this week. The Dow gained 202 points on Tuesday, its biggest one-day jump of the year, after President Obama backed a proposal by six senators that would cut the country’s debt by $3.7 trillion over the next decade.