Cocker spaniel Midge was reported missing by her distressed owners at Roslin Glen, near Roslin, Midlothian, at about 11.40am today.
The dog had fallen 60ft down a sheer drop by the side of the North Esk river, the fire service said.
"The river was in spate and the dog managed to scramble out of the river up to a ledge which was still 30ft down from the top," a spokeswoman said.
Seven fire appliances, police and the Scottish SPCA were involved in the rescue mission.
Specialist line and water rescue crews lifted Midge off the ledge and she was reunited with her owners at about 2.15pm.
"We are really advising dog owners to keep dogs in sight or safely on a lead in areas where dangers may be present," the spokeswoman said.