This study presents a nature-inspired, and metaheuristic-based Marine predator algorithm (MPA) for solving the optimal power flow (OPF) problem. The significant insight of MPA is the widespread foraging strategy called the Levy walk and Brownian movements in ocean predators, including the optimal encounter rate policy in biological interaction among predators and prey which make the method to solve the real-world engineering problems of OPF. The OPF problem has been extensively used in power system operation, planning, and management over a long time. In this work, the MPA is analyzed to solve the single-objective OPF problem considering the fuel cost, real and reactive power loss, voltage deviation, and voltage stability enhancement index as objective functions. The proposed method is tested on IEEE 30-bus test system and the obtained results by the proposed method are compared with recent literature studies. The acquired results demonstrate that the proposed method is quite competitive among the nature-inspired optimization techniques reported in the literature.