The third place play-off went into extra time in Edmonton's Commonwealth Stadium after the teams were locked 0-0 at the end of 90 minutes.
But England were awarded a penalty after Lianne Sanderson was pulled down by Tabea Kemme in the box.
And Williams slotted in past former world goalkeeper of the year Nadine Angerer, who was playing her final match for Germany.
It was a first ever win by sixth-ranked England over world number one team Germany, winners in 2003 and 2007.