Exhibit 23.1 ACCOUNTANTS' CONSENT The Board of Directors National Bankshares, Inc.: We consent to incorporation by reference herein of our report dated February 5, 1999, relating to the consolidated balance sheets of National Bankshares, Inc. and subsidiaries as of December 31, 1998 and 1997, and the related consolidated statements of income and comprehensive income, changes in stockholders' equity, and cash flows for each of the years in the three- year period ended December 31, 1998, which report appears in the December 31, 1998 Annual Report on Form 10-K of National Bankshares, Inc. and subsidiaries incorporated by reference herein. Our report dated February 5, 1999 refers to the adoption of the provisions of Statement of Financial Accounting Standards No. 133, "ACCOUNTING FOR DERIVATIVE INSTRUMENTS AND HEDGING ACTIVITIES," as of October 1, 1998. KPMG LLP Roanoke, Virginia June 3, 1999