A service discovery method, comprising: receiving, by a second Neighbor Awareness Networking, NAN, device , a first service discovery message that is sent by a first NAN device and that is used for a service discovery, wherein the first service discovery message comprises first service identifier information, and the first service identifier information is used to indicate information about a service that is subscribed to or published by using the first service discovery message (step 204); and generating, by the second NAN device based on the first service discovery message, a second service discovery message used for the service discovery, and sending the second service discovery message (step 205), wherein the second NAN device serves as a service relay device that relays the service discovery initiated by the first NAN device, wherein the generating the second service discovery message based on the first service discovery message comprises: generating, by the second NAN device , second service identifier information based on the first service identifier information, wherein the second service discovery message comprises the second service identifier information and multi-hop service indication information, the second service identifier information is used to indicate information about a service that is subscribed to or published by using the second service discovery message, the second service identifier information is different from the first service identifier information, and the multi-hop service indication information is used to indicate that the second service discovery message is used to relay the service discovery. receiving, by a second Neighbor Awareness Networking, NAN, device , a first service discovery message that is sent by a first NAN device and that is used for a service discovery, wherein the first service discovery message comprises first service identifier information, and the first service identifier information is used to indicate information about a service that is subscribed to or published by using the first service discovery message (step 204); and generating, by the second NAN device based on the first service discovery message, a second service discovery message used for the service discovery, and sending the second service discovery message (step 205), wherein the second NAN device serves as a service relay device that relays the service discovery initiated by the first NAN device, wherein the generating the second service discovery message based on the first service discovery message comprises: generating, by the second NAN device , second service identifier information based on the first service identifier information, wherein the second service discovery message comprises the second service identifier information and multi-hop service indication information, the second service identifier information is used to indicate information about a service that is subscribed to or published by using the second service discovery message, the second service identifier information is different from the first service identifier information, and the multi-hop service indication information is used to indicate that the second service discovery message is used to relay the service discovery. <EOS>