Harrogate Town will compete in the Emirates FA Cup Third Round for the first time in history following a 2-1 win over League One Portsmouth at Fratton Park.