A magnitude five earthquake from Canada shook homes and buildings throughout Western New York for several seconds Wednesday afternoon.