Afghanistan clawed their way back after India's Shikhar Dhawan hit a blazing century on Thursday as the minnows capped their astonishing rise from war and refugee camps to joining the sport's elite.
Test cricket's newest team were on the receiving end of some aggressive batting as Dhawan, who smashed 107, and Murali Vijay, who made 105, put on a 168-run opening stand after the hosts elected to bat first in Bangalore.
But the Afghan bowlers struck back with four wickets, and a run out, in the final session as the hosts slipped from 280-1 to 347 for six at stumps at Bangalore's M Chinnaswamy Stadium.
Hardik Pandya, on 10, and Ravichandran Ashwin, on 7, were at the crease when play ended after an extended final session but only 78 overs were possible due to two rain interruptions.
Fast bowler Yamin Ahmadzai, who gave Afghanistan their first Test scalp after getting Dhawan out early in the second session, led the attack with two wickets.
"This was a dream come true for our nation. It was enjoyable and a little bit stress. Playing in India with India, the number one team, was a good experience," Ahmadzai, who returned impressive figures of 2-32 in his 13 overs, told reporters.
"Still, there are four days to go. We will try to do our best."
Afghanistan have become one of only 12 nations sanctioned to play Tests, the five-day format considered cricket's peak, after defying heavy odds to emerge as a force in the game.
But soon the rookies, captained by Asghar Stanikzai, realised they were up against the world's top Test side as Dhawan galloped to his century in just 87 deliveries, becoming the first Indian batsman to reach three figures on the opening day before lunch.
Dhawan hit 19 fours and three sixes as he set about the Afghan bowlers including spin sensation Rashid Khan, smashing three boundaries in the teenager's opening over.
Vijay took control after Dhawan's departure, putting together a 112-run second-wicket partnership with Lokesh Rahul who made 54.
Ahmadzai bowled Rahul, who dragged a delivery on to his stumps, and Wafadar trapped Vijay lbw to lift Afghan spirits.
Khan, who gave away 120 runs in 26 overs, then combined with fellow spinner Mujeeb Ur Rahman as the pair got a wicket each of skipper Ajinkya Rahane and Cheteshwar Pujara to pull things back.
"They came back very well in the final session and I am sure they are going to learn a lot of things, and go long way ahead," Dhawan said of Afghanistan.
"Of course I enjoyed my battle with him (Khan) and I dominated but he is a great bowler and on his day he will take some serious wickets."
Glued to the TV
Most cricket-loving Afghans were watching the match on TV back home as they prepared for a three-day public holiday marking the Muslim festival of Eid.
Afghans took to social media to celebrate the start of the Test, which comes amid a government ceasefire during the holy month of Ramadan.
"As a cricket fan I salute you all for bringing Afghanistan great pride," Jamal Sahar Kanwal from the eastern city of Jalalabad wrote on Facebook.
Earlier, Afghan President Ashraf Ghani sent his congratulations for what he called a "historic day".
"I am proud of the men who championed cricket in Afghanistan in the dawn of the century and believed in themselves that one day Afghanistan will play against the best in the world," he said.
Indian Prime Minister Narendra Modi tweeted: "May sports continue to bring our people closer and strengthen ties."
From camps to World Cups
Afghan cricket grew out of refugee camps in Pakistan where many families were based after they fled conflict in the 1980s and 1990s.
The national team have made giant strides against much richer and more stable countries, despite unrest at home which has forced them to train in India since 2015.
Afghanistan last year achieved full member status of the International Cricket Council, making them one of only 12 Test teams.
They gained one-day international status in 2009 and have qualified for their second 50-over World Cup to be held in England and Wales next year.
Afghanistan have also been part of four Twenty20 World Cups.
Last week they secured a T20 series sweep over Bangladesh helped by spin bowler Khan, 19, the stand-out star of this year's Indian Premier League.
Only last month, an attack on a cricket match in Khan's home city of Jalalabad killed eight people and wounded 45.
While Afghanistan's successes so far have come in short formats of cricket, they must now prove they can stand the physical and mental challenge of a five-day match.