Pericapsular nerve group (PENG) blocking is a novel nerve block modality for analgesia after total hip arthroplasty (THA); however, its analgesic efficacy is unclear. We aimed to compare the analgesic effect of ultrasound-guided PENG blocking and periarticular local infiltration analgesia after THA. This study involved patients undergoing unilateral primary THA at our institution between October 2022 and December 2022. Based on a prospective double-blind, randomized approach, patients were randomly divided into two groups: the PENG and infiltration groups. The former received ultrasound-guided pericapsular nerve block before surgery while the latter received local anesthesia and local infiltration analgesia during surgery. The primary outcome was the amount of morphine used for rescue analgesia within 48 h after surgery and the visual analog scale (VAS) pain score at 3, 6, 12, 24, and 48 h after surgery. Secondary outcomes consisted of postoperative hip function on the first and second postoperative days, including hip extension angle and flexion, as well as distance traveled by the patient. Tertiary outcomes included length of hospital stay and postoperative adverse reactions. The data were analyzed using SPSS 26.0. Using the appropriate statistical methodology, continuous and categorical data were analyzed, and p < 0.05 was considered statistically significant. There was no clear difference in morphine requirements during the first 24 hours postoperatively (5.8 ± 5.9 vs. 6.0 ± 6.3, p = 0.910), in the total postoperative morphine consumption (7.5 ± 6.3 vs. 7.8 ± 6.6, p = 0.889), and in the postoperative resting VAS pain scores (p > 0.05). However, the exercise VAS score in the PENG group was significantly higher than that in the infiltration group within 12 hours after surgery (6.1 + 1.2 vs. 5.4 + 1.0, p = 0.008). There was no significant difference in hip function, length of hospital stay, or incidence of complications between the two groups. The analgesic effect and functional recovery of ultrasound-guided pericapsular nerve block for THA was not superior to that of periarticular local infiltration analgesia.