Meaningful information sharing between the sensors of a wireless sensor network (WSN) necessitates node localization, especially if the information to be shared is the location itself, such as in warehousing and information logistics. Trilateration and multilateration positioning methods can be employed in two-dimensional and threedimensional space respectively. These methods use distance measurements and analytically estimate the target location; they suffer from decreased accuracy and computational complexity especially in the three-dimensional case. Iterative optimization methods, such as gradient descent (GD), offer an attractive alternative and enable moving target tracking as well. This chapter focuses on positioning in three dimensions using time-of-arrival (TOA) distance measurements between the target and a number of anchor nodes. For centralized localization, a GD-based algorithm is presented for localization of moving sensors in a WSN. Our proposed algorithm is based on systematically replacing anchor nodes to avoid local minima positions which result from the moving target deviating from the convex hull of the anchors. We also propose a GD-based distributed algorithm to localize a fixed target by allowing gossip between anchor nodes. Promising results are obtained in the presence of noise and link failures compared to centralized localization. Convergence factor issues are discussed, and future work is outlined.