Shares of Yahoo! (NASDAQ: YHOO) fell more than 5% after hours on weaker-than-expected display ad sales. Fourth quarter earnings topped targets.

Revenue fell 2% year-over-year to $1.2 billion, after accounting for traffic acquisition costs, or TAC. Adjusted earnings nevertheless climbed 31% to $0.46 a share. Analysts had been looking for $0.38 a share in profit on $1.2 billion in revenue, according to data compiled by Yahoo! Finance.

For all of 2013, revenue fell 1% to $4.426 billion ex-TAC while non-GAAP profit rose 16% to $1.52 a share. An 11% year-over-year decline in diluted shares outstanding helped boost Q4 and full-year profits.

Segment results also varied. Display ad sales ex-TAC fell 6% for the quarter and 9% for the year, and that's in spite of a 3% increase in ads sold everywhere except South Korea. Price per ad (again, excluding South Korea) fell 7%. The results may help to explain why former top Yahoo! ad executive Henrique de Castro left the company earlier this month.

Search ad revenue ex-TAC climbed 8% in Q4 and 6% for all of 2013. Paid clicks also rose 17% while price per click decreased 3%, a recurring trend now that Yahoo! and peers are serving more ads to mobile devices.

If there was a bright spot to the report, it's that Yahoo! is adding traffic, as CEO Marissa Mayer and her team are aiming to bring more original content directly to readers.

"In Q4, we launched the new Yahoo Mail, Yahoo Finance, and our new Flickr photo books, while quickening our pace of experimentation," Mayer said in a statement. "We are extremely heartened by the year-over-year traffic increase we experienced in 2013, an early sign of return on our investments and the acquisitions we've made."

Notably, Yahoo! delivered more overall traffic than Google (GOOGL -1.23%) in July of last year -- the first such victory in two years.