The present study aimed to investigate the changes in miRNA-142 and bone morphogenetic protein-2 (BMP-2) expression before and after hip replacement surgery, and to determine their association with receptor activator of NF-κB ligand (RANKL) and osteoprotegerin (OPG). For this purpose, 142 cases of hip arthroplasty in patients with femoral neck fracture were selected as the research group, and 50 cases of healthy individuals who underwent a physical examination during the same time period were selected the control group. Serum miR-142 and BMP-2 levels were measured by RT-qPCR before and after surgery in the research group and the control group. Serum RANKL and OPG levels were detected before and after surgery by enzyme-linked immunosorbent assay (ELISA). The levels of serum miR-142 and BMP-2 in the research group were significantly lower than those in the control group. At 1 month after surgery, the levels of serum miR-142 and BMP-2 in the research group were significantly higher than those before surgery, and at 6 months after surgery, and they were higher than those in the control group. Pearson's correlation analysis revealed that the serum levels of miR-142 positively correlated with the BMP-2 levels before surgery, at 1 month after surgery, and at 6 months after surgery in the research group. The results of ROC curve analysis revealed that the AUC values of serum miR-142 and BMP-2 were 0.911 and 0.861, respectively. At 1 month after surgery, the levels of serum miR-142 and BMP-2 in group A (patients with a good or excellent recovery) were significantly higher than those in group B (patients with a fair or poor recovery). The levels of serum RANKL and OPG in the research group significantly increased at 1 month after surgery. The serum levels of miR-142 and BMP-2 positively correlated with those of RANKL and OPG before surgery and at 1 month after surgery. On the whole, the findings of the present study indicate that pre-operative serum miR-142 and BMP-2 levels are valuable for evaluating the post-operative recovery of patients with femoral neck fracture undergoing hip replacement surgery. In addition, in the present study, at 1 month after surgery, the levels of both miR-142 and BMP-2 were related to the recovery of the patients, and positively correlated with the RANKL and OPG levels.