EXHIBIT 5.1 [Riordan & McKinzie letterhead] May 24, 2002 Advance Auto Parts, Inc. 5673 Airport Road Roanoke, Virginia 24012 Re: Advance Auto Parts, Inc. Registration Statement on Form S-8 ---------------------------------- Ladies and Gentlemen: You have requested our opinion with respect to certain matters in connection with the filing by Advance Auto Parts, Inc., a Delaware corporation (the "Company"), of a Registration Statement on Form S-8 (the "Registration Statement") with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Act"), in connection with the registration of 700,000 shares (the "Shares") of the Company's Common Stock, par value $.0001 per share ("Common Stock"), issuable pursuant to the Company's Employee Stock Purchase Plan (the "Plan"). In rendering the opinion set forth herein, we have made such investigations of fact and law, and examined such documents and instruments, or copies thereof established to our satisfaction to be true and correct copies thereof, as we have deemed necessary under the circumstances. Based on such review, we are of the opinion that the Shares issuable by the Company pursuant to the Plan are duly authorized, and when issued in accordance with the provisions of the Plan, will be legally issued, fully paid and nonassessable. We consent to the filing of this opinion letter as Exhibit 5.1 to the Registration Statement. This opinion letter is rendered as of the date first written above, and we disclaim any obligation to advise you of facts, circumstances, events or developments which hereafter may be brought to our attention and which may alter, affect or modify the opinion expressed herein. Our opinion is expressly limited to the matters set forth above and we render no opinion, whether by implication or otherwise, as to any other matters relating to the Company or the Shares. Very truly yours, RIORDAN & MCKINZIE