U.S. consumer sentiment rose to its highest level in a year in early July as gains in the stock market and better hiring conditions offset the drag from record gasoline prices, the University of Michigan said on Friday.

The University of Michigan (search) said its measure of confidence inched up to 96.5 so far this month from 96.0 in June, according to market sources who saw the subscription-only report. Analysts had been looking for a dip to 95.0.

The survey's expectations component ticked up to 86.6 from 85.0, while perceptions of current conditions eased to 112.0 from 113.2.

Consumer spending (search) accounts for two-thirds of overall U.S. economic activity, and any improvement in confidence is seen as a possible precursor to stronger growth.

However, in recent years the correlation between confidence and retail sales has weakened, with consumers buying new cars and homes in earnest even as they tell surveys that things are getting worse.

Indeed, while confidence levels remain near their recent average, retail sales surged 1.7 percent in June as car dealers made vehicle purchases more attractive through aggressive discounts.