Serena Williams has earned her place at the Miami Open finals following a hard fought win over third seed Simona Halep.