West Ham were awarded a controversial late penalty in their 2-1 win over Manchester United.