Stocks rallied sharply today, with the Dow Jones industrials gaining 172 points on better-than-expected gross domestic product growth last quarter despite the disruptions caused hurricanes Katrina and Rita. The major indexes finished an erratic week higher.