17-year-old Dane Holger Rune battled past fellow qualifier Sebastian Baez to earn his first win at ATP level.