Yes, the mechanic can fly the aircraft, according to this FAA legal interpretation (Williams, 2014):
The scenario you present is a mechanic who, as part of his duties,
conducts flight tests after performing maintenance on the aircraft,
and does not carry passengers or property for compensation or hire.
The mechanic holds a private pilot certificate with a valid third
class medical certificate. This situation is covered under §
61.113(b), which states that, "[a] private pilot may, for compensation or hire, act as pilot in command of an aircraft in connection with any
business or employment if (1) the flight is only incidental to that
business or employment and (2) the aircraft does not carry passengers
or property for compensation or hire." As these flight tests are
incidental to his employment as a mechanic, the mechanic is not in
violation of § 61.113 when conducting these flight tests