Bayne won the Daytona 500 this year but had never won in his previous 76 Nationwide starts in the series where he is a regular for Roush Fenway Racing.
Edwards, the Cup points leader, led 157 of 200 laps at the 1½-mile, high-banked track. He still led on the last restart before Bayne got a good run and eventually got by him.
Bayne's victory secured Ford's third manufacturing championship in the series.
Nationwide points leader Ricky Stenhouse finished sixth and has a 17-point lead over Elliott Sadler with two races to go.