The Event and Technical Committee of the World Cup approved the replacement.
Hafeez is suffering from a calf injury, which he picked up while batting in the second ODI against New Zealand in Napier on February 3.
Jamshed, the 25-year-old left-handed opener, has played 45 ODIs for Pakistan in which he has scored 1,413 runs with three centuries and eight half-centuries. His last ODI was against New Zealand in Abu Dhabi in December 2014
Any injury or illness-based replacement requires a written submission to the Event Technical Committee along with a diagnosis from a medical practitioner as to the extent of the injury or illness.
Once replaced, a player may not return to the squad save as an approved subsequent replacement for another injured or ill player.
Pakistan is in Pool B along with defending champions India, former winner the West Indies, African rivals South Africa and Zimbabwe and qualifiers Ireland and United Arab Emirates (UAE).
Pakistan will play its opening match against India at the Adelaide Oval on February 15.
Image: Nasir Jamshed
Photograph: Francois Nel/Getty Images
Pakistan's Hafeez ruled out of World Cup through injury
India has a good chance of winning World Cup: Kirsten
Meet India's 15-member World Cup squad
Miller replaces Narine in Windies WC squad; ICC approves
Williamson, Henry give New Zealand series win over Pakistan