Montgomery Scott served as chief engineer for the Constitution-class starship USS Enterprise during its five-year exploration mission and retained the post almost continuously until the ship was destroyed. He continued to serve on the Enterprise-A until that ship was decommissioned.
During his career on the Enterprise he earn the reputation as a miracle worker. He has admitted that this was due to some embellishment on his part but when his skills are needed he still manages to shine no matter the situation. There are multiple instances in which he has made repairs when conventional wisdom would indicate no chance of success. While on board a derelict USS-Constellation he was able to bring the ship's impulse engines and Phasers back online in order to allow the damaged ship to assist attacking a planet destroying robot. He was then able to rig the ship to explode on command in order to destroy the monster.
During the events of the Genesis incident, Scotty was able to repair the Enterprise for combat despite massive damage because of an ambush by the USS-Reliant. His skills while extraordinary did not allow him to continue to make repairs when radiation levels exceeded safe levels and because of the effects of the radiation he had become too ill to function.
Scott was assigned to the USS-Excelsior, despite his objections, and he used that position to sabotage the new Trans-Warp drive on the ship in order to allow himself, Kirk, Sulu and Chekov to hijack the still damaged Enterprise. Scott was able to rig the ship to operate with a much smaller crew then a normally possible skeleton crew.
When assigned the Enterprise-A he was required to basically rebuild the new Enterprise. He did manage to bring the transporters online long enough to use them before battle damage took them out of operation. He was the only one to not let himself become swayed by Spock's half-brother 'therapy.'