Stocks slipped lower minutes before the close after struggling with direction much of the day despite a strong report on retail sales.
The Dow Jones Industrial Averagewas barely higher following an 80-point rally in the previous session,putting the blue-chip index on pace to end higher for the ninth session out of the past 10.
Hewlett-Packard , Traveler's and Wal-Mart led the blue-chip index higher. Boeing and American Express fell.
The S&P 500and the tech-heavy Nasdaq rose. The CBOE Volatility Index, the mostly widely used gauge of fear in the market, rose above 21.
Technology, telecom and health care sectors gained, while financials declined.
Share prices had been higher across-the-board earlier in the session, but began to back off as the S&P topped 1,127, near the top of a trading range in place since about mid-May.
Until investors are ready for the market to break out of the range, stocks may have a hard time moving much higher, said Ryan Detrick, senior technical strategist at Schaeffer’s Investment Research.
Still, a robust August retail sales report and recent signs of strength in sectors that typically lead a bull market, namely consumer discretionary, retailers, and restaurants, is encouraging, Detrick said.
"It shows people are opening their pocketbooks and confidence is coming back," he said. "Leadership is coming from the sectors you want to see have leadership, which makes us think we may break out eventually."
Detrick added that "upside is the way to play this market," probably through to the end of the year.
Macro-economic data such as jobless claims and retail sales have driven the market's direction, although secular growth stories in areas such as technology, energy and health care may begin to lift stocks as well, said Lewis Piantedosi, lead portfolio manager at Eaton Vance Management.
Technology stocks, for instance, are mostly all higher across the board as "strong secular growth themes" continue to boost names like Salesforce , Netflix and Amazon.com , Piantedosi said.
Meanwhile, tech companies focused on the beleaguered PC business may have sunk low enough to attract investor attention, Piantesdosi said.
"We're seeing a nice rally in some of those stocks because we’re at a point where expectations are so low, we don’t have a high bar to jump over to meet expectations," he said.
Cisco shares jumped more than 3 percent after CEO John Chambers explained plans to begin dividend payments in 2011. Often called the "tech bellwether," analysts look to Cisco for clues about the health of the overall sector.
Semiconductors led tech stocks, with Texas Instruments and Qualcomm trading higher.
National Semiconductor shares rose even after Citigroup cut its price target on the chipmaker to $15 from $18.
The tech sector has gotten a boost recently from a spike in global M&A activity. According to Dealogic, technology-targeted M&A hit 4,150 deals in 2010, the highest number of deals since 2000. Deal volume is at $111.4 billion, up 50 percent from the $74.1 billion in volume seen in 2009. The biggest deal was Intel's $7.67 billion purchase of McAfee in mid-August.
Shares of most retailers spiked higher after a retail sales report revealed the highest gains in five months. JC Penney soared more than 6 percent, and led the S&P 500. Abercrombie & Fitch , Kohl's and Macy's also advanced.
On the earnings front, Best Buy jumped after the electronics retailer reported a higher-than-expected profit and raised its full-year outlook.
And Kroger rose after the supermarket chain posted higher earningsand stood by its full-year profit forecast.
Financials slid after rising Monday after news was released on new global bank capital requirements. BB&T , meanwhile, sank after CEO Kelly King said plans to sell more than $1 billion in loans.
BlackRock shares soared after the money manager's CEO said that he was seeing much stronger inflows from investorsin the third quarter.
American International Group slumped after news the insurance firm is planning to convert the government's preferred shares to common stock in an effort to wean itself more quickly from the government, the Wall Street Journal reported.
Most steel stocks fell after Nucor said its earnings in the third quarter will be lower than expected because of slowing demand and bigger-than-expected inventory charges. In addition, ArcelorMittal and US Steel fell after Goldman Sachs downgraded the industrials sector to "neutral."
Boeing shares were under pressure after news the World Trade Organization ruled the company received illegal subsidies from the U.S. government, according to a report on the Wall Street Journal's website.
Also, Goldman Sachs cut its rating on the energy sector to "neutral" from "overweight" and the consumer staples sector to "overweight."
Gold ended at a record high of $1,269.70 an ounce, the biggest one-day gain since mid-February, as investors continued to flock to the safety of the precious metal. Shares of gold miners were mostly higher across the board.
In merger and acquisitions news, Green Mountain Coffee Roasters said it will pay $890 million to purchase Canadian competitor Van Houtte.
In economic news, business inventoriesposted the largest increase in two years, rising 1 percent in July, the Commerce Department reported. Economists had expected an increase of 0.8 percent.
And the National Federation of Independent Businesses said its small business index showed a slight increasein optimism in August, but the figure remains consistent with expectations of a recession.
Meanwhile, there are mixed messages about investor confidence. A survey conducted by CNBC and AP found that many individual investors see the stock market as unfair to them and they have little confidence in regulators to fix it. But Morgan Stanley CEO and President James Gorman said on CNBC that confidence among investors is slowly returning.
On the Calendar:
WEDNESDAY: MBA mortgage applications, Empire State manufacturing survey, import and export prices, industrial production, weekly oil inventories
THURSDAY: PPI, current account, jobless claims, Philly Fed survey; before-the-bell earnings from FedEx, after-the-bell earnings from Oracle and Research In Motion
FRIDAY: CPI, consumer sentiment
More From CNBC.com: