Most industrial serial robots use decentralized joint controllers assuming rigid body dynamics. To prevent exciting the flexible mode, gains are kept low, resulting in poor control bandwidth and disturbance rejection. In this paper, a two-stage flexible joint discrete controller is presented, in which the decentralized approach is extended with a stiffness to take into account the dominant coupling mode. In the first-stage, an input shaping feedforward shapes the rigid closed-loop dynamics into desired dynamics that does not produce link vibrations. Robotic dynamic computation based on a recursive Newton-Euler Algorithm is conducted to update the feedforward link inertia parameter during robot motion. A second-stage is added to increase disturbance rejection. A generalized Smith predictor is developed to compensate for delay and feedback sensor filtering. An effective methodology is presented to optimize the control loop gains. Numerical simulations and experiments on a six-joint robot manipulator confirm that the proposed controller improves control performances in terms of bandwidth, vibration attenuation, and disturbance rejection.