Exhibit 23
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We consent to the incorporation by reference in Registration Statement No. 333-79979 on Form S-8 of National Bankshares, Inc. of our reports dated March 8, 2013 (March 25, 2013 as to the effects of the restatement discussed in Note 2) relating to our audits of the consolidated financial statements and internal control over financial reporting, which appear in this Annual Report on Form 10-K of National Bankshares, Inc. for the year ended December 31, 2012.
Our report dated March 8, 2013 (March 25, 2013 as to the effects of the restatement discussed in Note 2), on the effectiveness of internal control over financial reporting as of December 31, 2012, expressed an opinion that National Bankshares, Inc. had not maintained effective internal control over financial reporting as of December 31, 2012, based on criteria established in Internal Control — Integrated Framework issued by the Committee of Sponsoring Organizations of the Treadway Commission.
Winchester, Virginia
March 8, 2013 (March 25, 2013 as to the effects of the restatement discussed in Note 2)