Greg Van Avermaet (BMC) edged out Peter Sagan (Tinkoff) by one second to seal overall victory at Tirreno-Adriatico.