Rotations and waypoints

I have a GameObject that walks around using waypoints. How can I make it match it´s direction (rotation) to the next point it is moving towards? I mean, I want it to be “facing” the next waypoint (Vector3) as if it was walking in a direct line.

I´ve done it this way and it works close enough:

//just keep the original y to avoid strange behaviors while walking up or down stairs
Vector3 newDirection = new Vector3(target.x, transform.position.y, target.z) - transform.position;
transform.rotation = Quaternion.LookRotation(newDirection.normalized);