Federer was forced to play two tiebreaks after Evans impressed the crowd at the Rod Laver Arena with his splendid counter-punching skills.
The 37-year-old Swiss stepped up his game in the final set to prevail 7-6(5) 7-6(3) 6-3 and set up a third round meeting with American Taylor Fritz.
"I couldn't pull away early in the match - it helps when you can sneak in a quick break," said third seed Federer. "He played very well. It was hard to pull away, to his credit."
Spanish second seed Nadal, a 17-time Grand Slam winner, looked in complete control as he struck 33 winners in a 6-3 6-2 6-2 win over Ebden.
In the women's draw, reigning champion Caroline Wozniacki needed just 66 minutes to beat Swede Johanna Larsson 6-1 6-3.
The Dane will next face Russian Maria Sharapova in a clash of former world number one players.
Sharapova, chasing her first title in over a year, broke her Swedish opponent Rebecca Peterson five times in an impressive 6-2 6-1 victory.
Germany's three-time Grand Slam champion Angelique Kerber overcame Brazilian Beatriz Haddad Maia 6-2 6-3, while twice Wimbledon champion Czech Petra Kvitova made quick work of Romania's Irina-Camelia Begu in a 6-1 6-3 triumph.
Federer fends off British 'mirror' Evans to advance
Kerber wins battle of left-handers to progress to third round
Nadal spins way into third round with near flawless display
Rampaging Sharapova sets up mouth-watering Wozniacki clash
Novak, Rafa and I still Grand Slam favourites - Federer
Australia's top ranked players win through, salvaging local hopes
Tiafoe announces himself with Anderson upset
Bryan believes Murray could come back from hip surgery
Wozniacki sets up potential third-round showdown with Sharapova
Australia's Barty shines brightly as compatriots stumble
'Youth power' key to success for teenager Potapova
Back where it all began, Djokovic renews Tsonga rivalry
Australian Open order of play on Thursday
Highlights of Wednesday's third day of the Australian Open, the first Grand Slam tournament of the year (all times GMT):
1200 NADAL MARCHES PAST EBDEN
Second seed Rafa Nadal eased past local hope Matthew Ebden 6-3 6-2 6-2 to reach the Australian Open third round for the 13th time.
The Spaniard recorded his 57th match win at Melbourne to overtake Stefan Edberg into third place on the list for most Australian Open victories in the Open Era.
1040 DIMITROV PASSES CUEVAS TEST
Bulgaria's 20th seed Grigor Dimitrov switched gears after losing the second set tiebreak to beat Uruguayan Pablo Cuevas 6-3 6-7(5) 6-3 7-5 in the second round.
Dimitrov, who is bidding to reach the second week at Melbourne Park for a third consecutive year, will next face Italian Thomas Fabbiano.
0943 KERBER SAILS THROUGH
Angelique Kerber beat Brazilian qualifier Beatriz Haddad Maia 6-2 6-3 in 81 minutes to advance to the third round. The Wimbledon champion was helped along the way by Haddad Maia's 39 unforced errors. The second seed next meets Australian wildcard Kimberly Birrell.
0656 WOZNIACKI DOWNS LARSSON IN STRAIGHT SETS
Defending champion Caroline Wozniacki, the third seed, beat Sweden's Johanna Larsson 6-1 6-3 to ease into the third round.
The Dane controlled play from the baseline and won 70 percent of her first serves while making 14 fewer unforced errors than her opponent as she wrapped up the match in 66 minutes.
0644 VEKIC DUMPED OUT BY AUSTRALIAN QUALIFIER BIRRELL
Australian wildcard Kimberly Birrell beat 29th seed Donna Vekic 6-4 4-6 6-1 in nearly two hours to reach the third round of a Grand Slam for the first time.
0615 FEDERER MADE TO WORK HARD BY EVANS BUT PROGRESSES
Holder Roger Federer was pushed to the limit early in his second round match by Dan Evans but the third seed held firm to seal a 7-6(5) 7-6(3) 6-3 victory over the Briton.
After edging the first two sets against a determined Evans, Federer got into the groove in the third set and broke for a 3-1 lead before closing out the win in two hours and 35 minutes.
0541 CILIC BEATS MCDONALD
Marin Cilic overcame a mid-match blip by losing the second set but recovered to defeat unseeded American Mackenzie McDonald 7-5 6-7(9) 6-4 6-4. The Croatian set up a third round meeting with Fernando Verdasco or Radu Albot.
0529 ANDERSON STUNNED BY TIAFOE
Fifth seed Kevin Anderson cruised through the opening set against Frances Tiafoe but lost his way thereafter, allowing the American youngster to seal a 4-6 6-4 6-4 7-5 upset victory.
0423 BARTY TOO GOOD FOR WANG
Local favourite Ashleigh Barty continued her strong start to the tournament as she thumped China's Wang Yafan 6-2 6-3 to move into the third round.
The 15th seed, who warmed up for the season's first major by reaching the final of last week's Sydney International, takes on Maria Sakkari in the third round after the Greek beat local qualifier Astra Sharma 6-1 6-4.
0203 STEPHENS ADVANCES TO FACE MARTIC
American fifth seed Sloane Stephens moved past Timea Babos 6-3 6-1 to set up a third round clash with Croatia's Petra Martic.
0149 SASNOVICH'S SENSE OF HUMOUR ON POINT
Aliaksandra Sasnovich was in a jocular mood following her 6-3 6-3 victory over 20th seed Anett Kontaveit.
"I will of course go eat McDonalds and eat some Nutella," she said when asked how she would prepare for the next round where she meets Anastasia Pavlyuchenkova, who upset ninth seed Kiki Bertens 3-6 6-3 6-3.
"No. I'm joking. I will of course go shopping."
0115 GARCIA SHRUGS OFF ATTACK OF HIVES
Women's 19th seed Caroline Garcia ended the hopes of Australian Zoe Hives to become the first player into the third round with a 6-3 6-3 victory in just 65 minutes on the 1573 Arena.
The 22-year-old Hives had provided something of a boost for local fans on Monday when she beat American Bethanie Mattek-Sands in the first round, but was unable to hold off the Frenchwoman, who now will meet either Sachia Vickery or Danielle Collins in the third round.
0010 PLAY UNDERWAY AT MELBOURNE PARK
Play got underway on schedule under sunny skies at 11 a.m. local time (0000 GMT) with the temperature hovering just under the 23 degrees Celsius mark with a forecast high of 26C. (Compiled by Greg Stutchbury, Shrivathsa Sridhar and Hardik Vyas; Editing by Frank Pingue/Greg Stutchbury/Amlan Chakraborty/Christian Radnedge/Ken Ferris)