In this paper, we present a fourth order method for computing simple roots of nonlinear equations by using suitable Taylor and weight function approximation. The method is based on Weerakoon-Fernando method [S. Weerakoon, G.I. Fernando, A variant of Newton's method with third-order convergence, Appl. Math. Lett. 17 (2000) 87-93]. The method is optimal, as it needs three evaluations per iterate, namely one evaluation of function and two evaluations of first derivative. So, Kung and Traub's conjecture is fulfilled. We also perform some numerical tests that confirm the theoretical results and allow us to compare the proposed method with some existing methods of the same type.