Earthquake signal detection and seismic phase picking are challenging tasks in the processingof noisy data and the monitoring of microearthquakes. Here we present a global deep-learning model for simultaneous earthquake detection and phase picking. Performing thesetwo related tasks in tandem improves model performance in each individual task by com-bining information in phases and in the full waveform of earthquake signals by using ahierarchical attention mechanism. We show that our model outperforms previous deep-learning and traditional phase-picking and detection algorithms. Applying our model to5 weeks of continuous data recorded during 2000 Tottori earthquakes in Japan, we were ableto detect and locate two times more earthquakes using only a portion (less than 1/3) ofseismic stations. Our model picks P and S phases with precision close to manual picks byhuman analysts; however, its high efficiency and higher sensitivity can result in detecting andcharacterizing more and smaller events.