Wireless communications for IoT in smart cities may be affected by Non-Line-of-Sight (NLOS) propagation conditions due to obstacles such as buildings, trees, and others. LoRaWAN technology transmits information through several kilometers in one hop, from a source node to a gateway. However, packet reception decreases when the link has NLOS conditions and there are no alternative routes for packet delivery. This paper presents a LoRa implementation of MACGSP6, a Gossip-based routing algorithm, to improve communications in a LoRaWAN network where all nodes have NLOS conditions. The paper compares the packet delivery ratio of LoRaWAN and MACGSP6. Results show that packet delivery to the gateway increased from 0% with LoRaWAN to a minimum of 53% with the routing algorithm. Additionally, most packets were delivered using the shortest path available, even when the algorithm does not explicitly compute the routes, decreasing the delay associated with this process. Thus, the proposed solution is useful for IoT applications in smart cities, such as smart metering and structural health monitoring, where one relay node can forward the information of many other nodes.