Semantic web services (SWS) technology is developed to overcome the shortcomings of traditional standards, such as WSDL and UDDI, and enable maximal automation in all aspects of web service. But great improvement of capability in SWS-based service discovery is still desired. To address this issue, we present a distributed and semantic-matching-based approach for SWS publication and discovery by leveraging structured P2P technology. In this paper, first, we present our service matching rule which focuses on the inputs and outputs of SWS. Then, to realize this rule in open distributed environment and achieve the optimal match between a query and its qualified services, we propose not only a concept of ordered-concept-tree (OCT) to semantically sort the relevant concepts for service matching, but also a method to publish ontologies on structured P2P network to freely share and make full use of the concepts defined in different ontologies for OCT construction. Finally, we present a method for SWS publication on P2P network and an algorithm for service discovery. We also conduct experiments to evaluate our approach and the experimental results demonstrate its scalability, effectiveness, and callback capability to discover semantic web services.