Rory McIlroy birdied the last two holes on Sunday to win by 1 stroke at the Scottish Open in North Berwick, Scotland.