This work proposes a novel piezoelectric tuned mass damper (PE-TMD) with dual function of energy harvesting and vibration control. The dual function is achieved by introducing several piezoelectric transducers into the conventional TMD. Unlike the conventional TMDs, the stiffness and damping of the PE-TMD can be adjusted by changing the circuit resistance. Moreover, the vibration energy absorbed from the primary structure, which is dissipated by the conventional TMD in the form of thermal energy, can be efficiently converted into electrical energy by the piezoelectric transducers for reuse. A railway bridge is selected as the research object to investigate the performance of the PE-TMD. The electromechanical coupling equations between the bridge and the PE-TMD are given first and then verified by a scaled model experiment. The results show the feasibility of the PE-TMD to achieve the two functions of vibration control and energy harvesting simultaneously. Subsequently, the parameters optimized results show that when the damper is completely replaced by the piezoelectric transducers, the two functions can be optimized simultaneously. The expressions for the optimal parameters to optimize the two functions are derived separately, and they are consistent. Finally, the performance comparison with the optimal conventional TMD shows that the optimal PE-TMD exhibits a slightly better performance in vibration control, and its output electrical power is almost identical to the dissipated power by the conventional TMD.