It happened on Boxing Day at about 7pm on Cowersley Lane in Huddersfield.
Two vehicles, a a Ford Transit Connect CDV and a Ford Fusion pulled alongside another car which was parked up.
Five men then got out of the two cars and attacked the car of the 25-year-old man who was sat inside it with two friends.
The 25-year-old and a 28-year-old man were stabbed during the attack.
The incident ended after the victims attempted to drive away, with the suspects fleeing in their own vehicles.
Both men were taken to hospital with serious injuries.
The injuries are not considered life threatening.
Detective Inspector Diane Johnson of Kirklees District CID, said: "A number of enquiries are ongoing today into this incident which we are treating as targeted.
"Both victims received serious injuries and I would like to speak with anyone who saw what happened or who saw a Ford Transit Connect and a Ford Fusion in the immediate area just before or just after the attack.
"Anyone who has information should contact Kirklees District CID on 101 referencing crime number 13190659148 or can make reports online at www.wesstyorkshire.police/101livechat .
"Reports can also be made anonymously to the independent Crimestoppers charity on 0800 555 111."