
<PAGE>   1
 
   
                                                                     EXHIBIT 5.1
    
 
   
                     [LETTERHEAD OF DAVIS POLK & WARDWELL]
    
 
   
                                 JULY 23, 1997
    
 
   
CVS Corporation
    
   
One CVS Drive
    
   
Woonsocket, RI 02895
    
 
   
Ladies and Gentlemen:
    
 
   
     We have acted as counsel to CVS Corporation ("CVS") in connection with CVS'
Registration Statement on Form S-3 (the "Registration Statement") filed with the
Securities and Exchange Commission under the Securities Act of 1933, as amended
(the "Securities Act"), relating to the registration of shares (the "Shares") of
common stock, par value $.01 per share, of CVS to be sold by certain
stockholders of CVS.
    
 
   
     We have examined originals or copies, certified or otherwise identified to
our satisfaction, of such documents, corporate records, certificates and other
instruments, and have conducted such other investigations of fact and law, as we
have deemed necessary or advisable for the purposes of this opinion.
    
 
   
     On the basis of the foregoing, we are of the opinion that the Shares have
been duly authorized and are validly issued, fully paid and non-assessable.
    
 
   
     We are members of the Bar of the State of New York and the foregoing
opinion is limited to the laws of the State of New York, the federal laws of the
United States of America and the General Corporation Law of the State of
Delaware.
    
 
   
     We hereby consent to the filing of this opinion as an exhibit to the
Registration Statement. In addition, we consent to the reference to us under the
caption "Legal Matters" in the Prospectus constituting a part of the
Registration Statement.
    
 
   
                                          Very truly yours,
    
 
   
                                          /s/ DAVIS POLK & WARDWELL
    
