Spinal surgery is associated with severe diffuse pain in the postoperative period. Effective pain management plays an essential role in reducing morbidity and mortality. This study is designed to compare the ultrasound-guided erector spinae plane (ESP) block and surgical infiltrative ESP block for postoperative analgesia management after lumbar spinal fusion surgery. The patients who underwent two or three levels of posterior lumbar spinal fusion surgery were randomly allocated into one of three groups with 30 patients each (Group SE = Surgical ESP block; Group UE = ultrasound-guided ESP block; Group C = Controls). The primary aim was to compare postoperative opioid consumption, and the secondary aim was to evaluate postoperative dynamic and static pain scores and the incidence of opioid-related adverse effects. There was a significant difference in terms of opioid consumption, rescue analgesia on demand, and both static and dynamic pain scores between groups at all time periods (p < 0.05). Group SE and Group UE had lower pain scores and consumed fewer opioids than the controls (p < 0.05). However, the Group UE had lower pain scores and opioid consumption than the Group SE. The sedation level of patients was significantly higher in the control group than in the other two groups. Also, nausea was more common in controls than in the other groups. While both surgical and ultrasound-guided ESP blocks reduced opioid consumption compared to the controls, the patients who received ultrasound-guided ESP blocks experienced better postsurgical pain relief than those in the other groups (surgical ESP and controls).