Rafael Nadal lifted his first hardcourt title since 2010 after outlasting Juan Martin Del Potro in the BNP Paribas Open final at Indian Wells.