* CVS reports earnings a penny higher than Wall Street view
* Revenue gains 13.3 percent to $30.23 billion
* Sees 2012 earnings of $3.38-$3.41/share, Street view $3.37
* Shares slip mid-morning
Nov 6 (Reuters) - CVS Caremark Corp posted a higher quarterly profit and raised its expectations for the year on Tuesday as it filled more prescriptions with generic medicines and its drugstores retained former Walgreen patrons.
The company has been working on keeping customers who switched to its stores during an impasse between larger drugstore rival Walgreen Co and pharmacy benefits manager competitor Express Scripts Holding Co.
Walgreen did not fill Express Scripts prescriptions from the beginning of the year until mid-September. This gave CVS and other drugstores the opportunity to woo Walgreen customers who had to go elsewhere.
CVS expects to retain at least 60 percent of the prescriptions it gained through the fourth quarter, up from its prior goal of keeping at least 50 percent, Chief Executive Officer Larry Merlo said in an interview.
``We continue to view CVS's outlook for retention as conservative, as we estimate Walgreens has recaptured roughly 25 percent of prescriptions lost during the impasse thus far through October,'' said William Blair analyst Mark Miller.
Shares of CVS, which operates the No. 2 U.S. drugstore chain, gained 2 percent in early trading but reversed course, slipping 29 cents to $46.34, later in the session.
The results came a day after Express Scripts said analysts' forecasts for its 2013 results were too aggressive, casting doubt on how well it is integrating its $29 billion purchase of Medco Health Solutions Inc. Express Scripts shares plunged more than 16 percent on Tuesday morning.
CVS said it had earned $1.01 billion, or 79 cents per share in the third quarter, up from $868 million, or 65 cents per share, a year earlier.
Excluding intangible asset amortization related to acquisitions, the profit was 85 cents per share. That topped analysts' expectations of 84 cents, according to Thomson Reuters I/B/E/S, and was ahead of the company's forecast of 81 cents to 83 cents.
CVS has increased its marketing to hold onto the new customers it gained during the earlier part of 2012, and it will spend more during the fourth quarter to work on retaining them. The increased marketing spending is already included in the company's outlook, Merlo said.
CVS expects to earn $1.08 to $1.11 per share on an adjusted basis in the fourth quarter, which includes a hit of about a penny per share from Hurricane Sandy. More than 1,100 CVS stores were closed at the height of the storm last week and 20 remain closed. Some 15 stores suffered extensive damage and CVS said it does not know when those will reopen.
CVS is raising its fourth-quarter expectations for its pharmacies because it has been keeping more Express Scripts prescriptions, Merlo said. He also cited a rise in flu-related prescriptions and shots, more visits by patients to doctors over the last six months and an increase in Medicare Part D prescriptions.
At the same time, CVS's drugstores and pharmacy benefits units are filling more prescriptions with generic drugs, which are more profitable than brand-name versions.
Revenue rose 13.3 percent to $30.23 billion, beating the analysts' average forecast of $30.09 billion.
Revenue in the pharmacy services business jumped 22.2 percent to $18.1 billion, helped by the addition of new clients, higher drug costs and the growth of its Medicare Part D program for older people.
Revenue at the CVS drugstore chain rose 5.5 percent to $15.5 billion. Sales at stores open a least a year rose 4.3 percent, topping the company's August forecast of a 2.5 percent to 3.5 percent increase.
CVS forecast full-year earnings per share of $3.38 to $3.41, excluding special items. It previously said it had expected $3.32 to $3.38, and the analysts' average estimate is $3.37.
The company expects same-store sales to rise 2 percent to 3 percent in the fourth quarter and 4.75 percent to 5 percent this year.
CVS plans to give its forecast for 2013 when it meets with analysts in New York on Dec. 13.