NZ grab tough win over Boks, clinch title