Non-invasive neuroimaging techniques have been widely used to investigate pain in health and disease, with the aim of finding new approaches to alleviate pain and improve patient wellbeing. Due to the low signal-to-noise ratio, high dimensional, and sparse properties of neuroimaging data, machine learning techniques have been introduced and received increasingly attention in clinical decision-making and therapeutic development of pain research. In this talk, I will introduce our recent work in combing machine learning and neuroimaging with the applications on studying pain mechanism to pain diagnosis, and ultimately analgesia. First, I will present our work on studying neural mechanisms of experimental pain, with a focus on how pre-stimulus brain activity modulating subjective pain perception. Next, I will explain the importance of developing neuroimaging-based diagnostic tools for pain and present our work in assessing subjective pain perception in healthy and patient populations. Finally, I will introduce our ongoing work on developing individualized treatment plans for chronic low back pain based on functional brain connectome.