The unpredictability and ever changing network topology of VANETs evolve to the biggest challenge of determining the optimal path for the networks. The geographic information-based routing protocol is an important branch of the routing protocol for VANETs. A classic routing protocol in that area is GPSR and a modified version of this is DVA-GPSR. We analyzed the shortcomings of GPSR and DVA-GPSR, and proposed a new routing protocol for VANETs which is based on a neural network. We designed a neural network model and used the node parameter data from the global optimal path to train the neural network. The neural network learns how to choose the better next-hop, in order to overcome the local maximum congestion problem, and improve the network efficiency. In response to the problem of no public dataset, we have established our simulation database. For the input matrix features, a targeted neural network structure model is designed, and we verified the neural network model on our dataset. The verification results prove that our model is applicable, and the accuracy rate is 99%. Compared with GPSR and DVA-GPSR, the protocol proposed in this paper has lower latency and higher packet delivery ratio.